├── loadFunctionTable ├── .gitignore └── loadFunctionTables.py ├── slimshader ├── Gemini.dll ├── AvalonDock.dll ├── AvalonDock.pdb ├── GraphSharp.dll ├── QuickGraph.dll ├── SlimShader.dll ├── SlimShader.pdb ├── Caliburn.Micro.dll ├── Caliburn.Micro.pdb ├── QuickGraph.Data.dll ├── SlimShader.Studio.exe ├── SlimShader.Studio.pdb ├── GraphSharp.Controls.dll ├── QuickGraph.Graphviz.dll ├── System.Reactive.Core.dll ├── System.Reactive.Linq.dll ├── AvalonDock.Themes.VS2010.dll ├── AvalonDock.Themes.VS2010.pdb ├── QuickGraph.Serialization.dll ├── SlimShader.VirtualMachine.dll ├── SlimShader.VirtualMachine.pdb ├── System.Reactive.Interfaces.dll ├── System.Windows.Interactivity.dll ├── QuickGraph.Data.xml ├── QuickGraph.Graphviz.xml └── System.Reactive.Interfaces.xml ├── TextureMapping ├── slinger1.png ├── slinger2.png ├── slinger3.png └── slinger4.png ├── 010 Scripts ├── FixZombie.1sc ├── InjectShader.1sc ├── ShaderExtract.1sc └── CopyConstantBuffer.1sc ├── shaderTest ├── shaders.shader └── shader_example.cpp ├── LICENSE ├── fetch_shader_classes ├── list_bindings.py ├── fetch_classes.py └── ListBindingNames.ryo └── 010 Templates ├── LMT.bt ├── MHWGui.bt ├── Shader.bt ├── IBShader.bt ├── DXBC.bt ├── MRLTemplate.bt ├── MOD3.bt └── IBMRLTemplate.bt /loadFunctionTable/.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | test.txt 3 | backup 4 | cache.db -------------------------------------------------------------------------------- /slimshader/Gemini.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/Gemini.dll -------------------------------------------------------------------------------- /slimshader/AvalonDock.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/AvalonDock.dll -------------------------------------------------------------------------------- /slimshader/AvalonDock.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/AvalonDock.pdb -------------------------------------------------------------------------------- /slimshader/GraphSharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/GraphSharp.dll -------------------------------------------------------------------------------- /slimshader/QuickGraph.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/QuickGraph.dll -------------------------------------------------------------------------------- /slimshader/SlimShader.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/SlimShader.dll -------------------------------------------------------------------------------- /slimshader/SlimShader.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/SlimShader.pdb -------------------------------------------------------------------------------- /TextureMapping/slinger1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/TextureMapping/slinger1.png -------------------------------------------------------------------------------- /TextureMapping/slinger2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/TextureMapping/slinger2.png -------------------------------------------------------------------------------- /TextureMapping/slinger3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/TextureMapping/slinger3.png -------------------------------------------------------------------------------- /TextureMapping/slinger4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/TextureMapping/slinger4.png -------------------------------------------------------------------------------- /slimshader/Caliburn.Micro.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/Caliburn.Micro.dll -------------------------------------------------------------------------------- /slimshader/Caliburn.Micro.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/Caliburn.Micro.pdb -------------------------------------------------------------------------------- /slimshader/QuickGraph.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/QuickGraph.Data.dll -------------------------------------------------------------------------------- /slimshader/SlimShader.Studio.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/SlimShader.Studio.exe -------------------------------------------------------------------------------- /slimshader/SlimShader.Studio.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/SlimShader.Studio.pdb -------------------------------------------------------------------------------- /slimshader/GraphSharp.Controls.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/GraphSharp.Controls.dll -------------------------------------------------------------------------------- /slimshader/QuickGraph.Graphviz.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/QuickGraph.Graphviz.dll -------------------------------------------------------------------------------- /slimshader/System.Reactive.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/System.Reactive.Core.dll -------------------------------------------------------------------------------- /slimshader/System.Reactive.Linq.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/System.Reactive.Linq.dll -------------------------------------------------------------------------------- /slimshader/AvalonDock.Themes.VS2010.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/AvalonDock.Themes.VS2010.dll -------------------------------------------------------------------------------- /slimshader/AvalonDock.Themes.VS2010.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/AvalonDock.Themes.VS2010.pdb -------------------------------------------------------------------------------- /slimshader/QuickGraph.Serialization.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/QuickGraph.Serialization.dll -------------------------------------------------------------------------------- /slimshader/SlimShader.VirtualMachine.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/SlimShader.VirtualMachine.dll -------------------------------------------------------------------------------- /slimshader/SlimShader.VirtualMachine.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/SlimShader.VirtualMachine.pdb -------------------------------------------------------------------------------- /slimshader/System.Reactive.Interfaces.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/System.Reactive.Interfaces.dll -------------------------------------------------------------------------------- /slimshader/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheCrazyT/MHW-Research/HEAD/slimshader/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /010 Scripts/FixZombie.1sc: -------------------------------------------------------------------------------- 1 | //------------------------------------------------ 2 | //--- 010 Editor v9.0 Script File 3 | // 4 | // File: 5 | // Authors: 6 | // Version: 7 | // Purpose: 8 | // Category: 9 | // History: 10 | //------------------------------------------------ 11 | int i; 12 | for(i = 0; i 2 | 3 | 4 | QuickGraph.Data 5 | 6 | 7 | 8 | 9 | An algorithm that renders a DataSet graph to the Graphviz DOT format. 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /010 Scripts/InjectShader.1sc: -------------------------------------------------------------------------------- 1 | const char SHADER_PACKAGE[] = "d:\\tmp\\shaders\\ShaderPackage.sdf"; 2 | const char SHADER_TEMPLATE[] = "d:\\Backups_and_projects\\BlenderScripts\\MHW-Research\\010 Templates\\Shader.bt"; 3 | int idx = FindOpenFile(SHADER_PACKAGE); 4 | if(idx==-1){ 5 | FileOpen(SHADER_PACKAGE); 6 | } 7 | int shaderIdx = InputNumber("Input shaderindex","Input shaderindex","0"); 8 | char filename[] = InputOpenFileName("Input shader filename.","Shader (*.shdr)"); 9 | 10 | idx = FindOpenFile(SHADER_PACKAGE); 11 | FileSelect(idx); 12 | 13 | int64 fs1 = FileSize(); 14 | InsertFile(filename,fs1); 15 | RunTemplate(SHADER_TEMPLATE); 16 | int64 fs2 = FileSize()-fs1; 17 | 18 | shaderDatas.shaderData[shaderIdx].length = fs2; 19 | shaderDatas.shaderData[shaderIdx].pos = fs1; 20 | RunTemplate(SHADER_TEMPLATE); -------------------------------------------------------------------------------- /shaderTest/shaders.shader: -------------------------------------------------------------------------------- 1 | struct VOut 2 | { 3 | float4 position : SV_POSITION; 4 | float4 color : COLOR; 5 | }; 6 | 7 | VOut VShader( 8 | float3 position : POSITION, 9 | float3 normal : NORMAL, 10 | float4 tangent : TANGENT, 11 | float2 uvp:UV_Primary, 12 | float2 upv2:UV_Secondary, 13 | float4 color:COLOR, 14 | float3 posPF:PositionPF, 15 | uint iId:SV_InstanceID 16 | ) 17 | { 18 | VOut output; 19 | 20 | output.color = color; 21 | output.position.x = position.x; 22 | output.position.y = position.y; 23 | output.position.z = position.z; 24 | output.position.w = 1.0; 25 | 26 | return output; 27 | } 28 | 29 | float4 PShader(float4 position : SV_POSITION) : SV_TARGET 30 | { 31 | return position; 32 | } 33 | /*float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET 34 | { 35 | return color; 36 | }*/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 TheCrazyT 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /010 Scripts/ShaderExtract.1sc: -------------------------------------------------------------------------------- 1 | //-------------------------------------- 2 | //--- 010 Editor v6.0.1 Script File 3 | // 4 | // File: 5 | // Author: CrazyT 6 | // Revision: 7 | // Purpose: 8 | //-------------------------------------- 9 | //maybe also helpful: 10 | // https://github.com/tgjones/slimshader 11 | 12 | RunTemplate(); 13 | int i; 14 | int cnt=head.shaderCount; 15 | string filename; 16 | int shaderPos[cnt]; 17 | int shaderLength[cnt]; 18 | for(i=0;i; 71 | return; 72 | }""" % (key,key,key)); 73 | 74 | print("}") 75 | print("") 76 | for key,filename in classFiles.items(): 77 | print("local int crc%s = createJamcrc(\"%s\");" % (key,key)); 78 | 79 | 80 | print("") 81 | for key,filename in classFiles.items(): 82 | print("//%s : %s" % (key,filename)) 83 | with open(os.path.join(rootPath,filename), 'r') as content_file: 84 | content = content_file.read() 85 | start = False 86 | pos = 0 87 | ai = 0 88 | for line in content.split("\n"): 89 | line = line.strip() 90 | line = line.replace("struct ","struct %s_" % key) 91 | if start == True: 92 | if line == "// {": 93 | continue; 94 | if line == "// }": 95 | print("};\n") 96 | break; 97 | if not '=' in line: 98 | m = re.search("Offset: +([0-9]+) Size: +([0-9]+)",line) 99 | if(m): 100 | offset = int(m.group(1)) 101 | if(offset != pos): 102 | print(" // align: %d to %d" % (pos,offset)) 103 | print(" ubyte align%d[%d];" % (ai,offset-pos)) 104 | pos += offset-pos 105 | ai += 1 106 | pos += int(m.group(2)); 107 | else: 108 | pass 109 | #print("// no offset") 110 | print (line[3:]) 111 | else: 112 | if line == "// cbuffer "+key: 113 | print("struct %s {\n" % key) 114 | start = True 115 | sg.close() 116 | -------------------------------------------------------------------------------- /010 Templates/LMT.bt: -------------------------------------------------------------------------------- 1 | //------------------------------------------------ 2 | //--- 010 Editor v8.0.1 Binary Template 3 | // 4 | // File: 5 | // Authors: CrazyT 6 | // Version: 7 | // Purpose: 8 | // Category: 9 | // File Mask: *.lmt 10 | // ID Bytes: 11 | // History: 12 | //------------------------------------------------ 13 | struct LMTKeyframeDef{ 14 | ubyte bufferType; 15 | ubyte usage; 16 | ubyte jointType; 17 | ubyte boneId; 18 | long bufferSize; 19 | float weight; 20 | long unkn2; 21 | uint64 bufferOffset; 22 | float referenceFrame[4]; 23 | uint64 boundsOffset; 24 | }; 25 | struct LMTVec3{ 26 | float x; 27 | float y; 28 | float z; 29 | }; 30 | struct LMTQuadraticVector3{ 31 | byte addcount; 32 | byte flags; 33 | short s; 34 | float vx; 35 | float vy; 36 | float vz; 37 | local int i=0; 38 | float f[8]; 39 | }; 40 | struct LMTVec3Frame{ 41 | float x; 42 | float y; 43 | float z; 44 | }; 45 | struct LMTQuatized8Vec3{ 46 | byte f[3]; 47 | byte reframe; 48 | }; 49 | struct LMTQuatized16Vec3{ 50 | short f[3]; 51 | short relframe; 52 | }; 53 | struct LMTQuat3Frame{ 54 | float f[3]; 55 | long l; 56 | }; 57 | struct LMTQuatFramev14{ 58 | long l1; 59 | long l2; 60 | }; 61 | struct LMTQuatized32Quat{ 62 | long l; 63 | }; 64 | struct LMTXWQuat{ 65 | long l; 66 | }; 67 | struct LMTYWQuat{ 68 | long l; 69 | }; 70 | struct LMTZWQuat{ 71 | long l; 72 | }; 73 | struct LMTQuatized11Quat{ 74 | short s[3]; 75 | }; 76 | struct LMTQuatized9Quat{ 77 | byte b[5]; 78 | }; 79 | string readKBR(LMTKeyframeDef &x){ 80 | string s; 81 | SPrintf( s, "BoundsOffset:%08x%08x BufferOffset:%08x%08x BufferType:%x",x.boundsOffset>>32,x.boundsOffset,x.bufferOffset>>32,x.bufferOffset,x.bufferType); 82 | return s; 83 | } 84 | 85 | struct Head{ 86 | uint id; 87 | short version; 88 | short numBlocks; 89 | if(version > 90){ 90 | uint64 unkn1; 91 | } 92 | 93 | uint64 offsets[numBlocks]; 94 | } head; 95 | 96 | local int i; 97 | local int isub; 98 | struct{ 99 | for(i=0;i; 110 | } 111 | }lheads; 112 | local int maxj = 0; 113 | struct{ 114 | local int b; 115 | local int correct = 0; 116 | for(i=0;i; 124 | maxj++; 125 | } 126 | } 127 | } kbrs; 128 | 129 | local int j; 130 | for(j=0;j; 137 | } 138 | local int cursize; 139 | for(j=0;j; 203 | } -------------------------------------------------------------------------------- /slimshader/QuickGraph.Graphviz.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | QuickGraph.Graphviz 5 | 6 | 7 | 8 | 9 | Edge formatter 10 | 11 | 12 | 13 | 14 | An algorithm that renders a graph to the Graphviz DOT format. 15 | 16 | type of the vertices 17 | type of the edges 18 | 19 | 20 | 21 | Dot output stream. 22 | 23 | 24 | 25 | 26 | Current image output type 27 | 28 | 29 | 30 | 31 | Client-side imagemaps 32 | 33 | 34 | 35 | 36 | HP-GL/2 format 37 | 38 | 39 | 40 | 41 | Server-side imagemaps 42 | 43 | 44 | 45 | 46 | FrameMaker MIF format 47 | 48 | 49 | 50 | 51 | MetaPost 52 | 53 | 54 | 55 | 56 | PCL format 57 | 58 | 59 | 60 | 61 | PIC format 62 | 63 | 64 | 65 | 66 | plain text format 67 | 68 | 69 | 70 | 71 | Portable Network Graphics format 72 | 73 | 74 | 75 | 76 | Postscript 77 | 78 | 79 | 80 | 81 | PostScript for PDF 82 | 83 | 84 | 85 | 86 | Scalable Vector Graphics 87 | 88 | 89 | 90 | 91 | Scalable Vector Graphics, gzipped 92 | 93 | 94 | 95 | 96 | VRML 97 | 98 | 99 | 100 | 101 | Visual Thought format 102 | 103 | 104 | 105 | 106 | Wireless BitMap format 107 | 108 | 109 | 110 | 111 | Helper extensions to render graphs to graphviz 112 | 113 | 114 | 115 | 116 | Renders a graph to the Graphviz DOT format. 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | Renders a graph to the Graphviz DOT format. 126 | 127 | 128 | 129 | 130 | delegate that initializes the algorithm 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /loadFunctionTable/loadFunctionTables.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python2 2 | import pefile 3 | import sys 4 | import sqlite3 5 | import md5 6 | import numpy as np 7 | from binascii import hexlify 8 | from struct import * 9 | 10 | def findFunctionTable(off,relocSectionData): 11 | global pe,sectionInfos 12 | for i in range(off,off+30): 13 | #0xE8 = call 14 | #0x48 = lea 15 | if (ord(relocSectionData[i]) == 0xE8)and(ord(relocSectionData[i+5]) == 0x48): 16 | relOff = unpack("i",relocSectionData[i+8:i+8+4])[0] 17 | n = i+7+5+relOff 18 | n += pe.OPTIONAL_HEADER.ImageBase + sectionInfos[".reloc"][1] 19 | return n 20 | return None 21 | def findFunctionTblStore(off,relocSectionData): 22 | global pe,sectionInfos 23 | 24 | #48 89 05 = mov qword ptr ds:[ 25 | for i in range(off,off+50): 26 | if (ord(relocSectionData[i]) == 0x48)and(ord(relocSectionData[i+1]) == 0x89)and(ord(relocSectionData[i+2]) == 0x05): 27 | relOff = unpack("i",relocSectionData[i+3:i+3+4])[0] 28 | n = i+7+relOff 29 | n += pe.OPTIONAL_HEADER.ImageBase + sectionInfos[".reloc"][1] 30 | return n 31 | return None 32 | def dict_factory(cursor, row): 33 | d = {} 34 | for idx, col in enumerate(cursor.description): 35 | d[col[0]] = row[idx] 36 | return d 37 | 38 | conn = sqlite3.connect('cache.db') 39 | conn.row_factory = dict_factory 40 | conn.execute('''CREATE TABLE IF NOT EXISTS raw_off_cache 41 | (s text, offset number)''') 42 | conn.execute('''CREATE TABLE IF NOT EXISTS function_table_pointers_cache 43 | (s text, voffset number)''') 44 | conn.execute('''CREATE TABLE IF NOT EXISTS function_table_pointers_store_cache 45 | (s text, voffset number)''') 46 | conn.execute('''CREATE TABLE IF NOT EXISTS function_reference_cache 47 | (s text, offset number)''') 48 | conn.execute('''CREATE TABLE IF NOT EXISTS config 49 | (name text,value text,value_int number)''') 50 | 51 | file_hash = None 52 | for row in conn.execute('SELECT value FROM config where name="file_hash"'): 53 | file_hash = row["value"] 54 | 55 | print("Loading ...") 56 | sys.stdout.flush() 57 | pefile.fast_load = True 58 | pe = pefile.PE('MonsterHunterWorld.exe') 59 | print("\n\n") 60 | #print(pe.dump_info()) 61 | #2e98b18 nDraw::Material 62 | #0000000149558F51 | 48:8D15 C00F94F9 | lea rdx,qword ptr ds:[142E99F18] | rdx:EntryPoint, 0000000142E99F18:"nDraw::Material" 63 | #0x142E99F18-0x149558F51=0xFFFFFFFFF9940FC7 64 | sectionInfos = {} 65 | for section in pe.sections: 66 | name = section.Name 67 | if "\x00" in name: 68 | name = name[:name.index("\x00")] 69 | sectionInfos[name] = (section,section.VirtualAddress,section.PointerToRawData, section.SizeOfRawData ) 70 | 71 | tlsSectionData = sectionInfos[".tls"][0].get_data() 72 | relocSectionData = sectionInfos[".reloc"][0].get_data() 73 | m = md5.new() 74 | m.update(tlsSectionData) 75 | m.update(relocSectionData) 76 | 77 | digest = hexlify(m.digest()) 78 | 79 | if(digest != file_hash): 80 | print("file changed,removing cache [%s != %s]" % (digest,file_hash)) 81 | conn.execute('DELETE FROM raw_off_cache') 82 | conn.execute('DELETE FROM function_table_pointers_cache') 83 | conn.execute('DELETE FROM function_table_pointers_store_cache') 84 | conn.execute('DELETE FROM function_reference_cache') 85 | if file_hash is None: 86 | conn.execute('INSERT INTO config (value,name) VALUES (?,?)',(digest,'file_hash')) 87 | conn.commit() 88 | else: 89 | conn.execute('UPDATE config SET value=? WHERE name="file_hash"',digest) 90 | conn.commit() 91 | 92 | rawOffsCache = {} 93 | refCache = {} 94 | fTblCache = {} 95 | fTblStoreCache = {} 96 | for row in conn.execute('SELECT s,offset FROM raw_off_cache'): 97 | rawOffsCache[row["s"]] = row["offset"] 98 | for row in conn.execute('SELECT s,voffset FROM function_table_pointers_cache'): 99 | fTblCache[row["s"]] = row["voffset"] 100 | for row in conn.execute('SELECT s,voffset FROM function_table_pointers_store_cache'): 101 | fTblStoreCache[row["s"]] = row["voffset"] 102 | for row in conn.execute('SELECT s,offset FROM function_reference_cache'): 103 | refCache[row["s"]] = row["offset"] 104 | 105 | 106 | virtualOffs = {} 107 | 108 | with open("strings.txt") as infile: 109 | #with open("test.txt") as infile: 110 | i = 0 111 | for s in infile: 112 | i += 1 113 | s = s.strip() 114 | k = 0 115 | if s in rawOffsCache: 116 | k = rawOffsCache[s] 117 | else: 118 | try: 119 | k = tlsSectionData.index("%s\x00" % s) 120 | conn.execute('INSERT INTO raw_off_cache VALUES (?,?)', (s,k)) 121 | if(i % 50 == 0): 122 | conn.commit() 123 | except ValueError as e: 124 | conn.execute('INSERT INTO raw_off_cache VALUES (?,?)', (s,None)) 125 | if(i % 50 == 0): 126 | conn.commit() 127 | continue 128 | if (not(k is None)) and (k > 0): 129 | virtualOffs[s] = pe.OPTIONAL_HEADER.ImageBase + k + sectionInfos[".tls"][1] 130 | 131 | 132 | print("len fTblCache: %d\nlen virtualOffs: %d\nend: %d\n\n" % (len(fTblCache),len(virtualOffs),len(relocSectionData))) 133 | conn.commit() 134 | print('"Name","FunctionTable offset","FunctionTable Store offset"') 135 | sys.stdout.flush() 136 | 137 | N1 = (len(relocSectionData) / 4) 138 | N2 = (len(relocSectionData[1:]) / 4) 139 | N3 = (len(relocSectionData[2:]) / 4) 140 | N4 = (len(relocSectionData[3:]) / 4) 141 | 142 | # "splitting" this improves performance, sadly now you need about 9GB ram just for this python script. 143 | cmpN1 = np.array(list(unpack("%di" % N1,relocSectionData[0:N1*4]))) 144 | cmpN2 = np.array(list(unpack("%di" % N2,relocSectionData[1:1+N2*4]))) 145 | cmpN3 = np.array(list(unpack("%di" % N3,relocSectionData[2:2+N3*4]))) 146 | cmpN4 = np.array(list(unpack("%di" % N4,relocSectionData[3:3+N4*4]))) 147 | 148 | X = pe.OPTIONAL_HEADER.ImageBase + sectionInfos[".reloc"][1] + 4 149 | L1 = np.arange(0,len(cmpN1)*4,4) 150 | L2 = np.arange(1,len(cmpN2)*4,4) 151 | L3 = np.arange(2,len(cmpN3)*4,4) 152 | L4 = np.arange(3,len(cmpN4)*4,4) 153 | 154 | cmpN1 += X+L1 155 | cmpN2 += X+L2 156 | cmpN3 += X+L3 157 | cmpN4 += X+L4 158 | 159 | for s in fTblCache: 160 | fTbl = fTblCache[s] 161 | fTblStore = fTblStoreCache[s] 162 | if(fTblStore is None): 163 | print("\"%s\",0x%016x," % (s,fTbl)) 164 | else: 165 | print("\"%s\",0x%016x,0x%016x" % (s,fTbl,fTblStore)) 166 | sys.stdout.flush() 167 | del virtualOffs[s] 168 | 169 | 170 | 171 | for s in virtualOffs: 172 | v = virtualOffs[s] 173 | x = 0 174 | X = np.where(cmpN1 == v)[0] 175 | if(len(X)>0): 176 | x = X[0] 177 | i = 0 178 | if x <= 0: 179 | X = np.where(cmpN2 == v)[0] 180 | if(len(X)>0): 181 | x = X[0] 182 | if x > 0: 183 | i = 1 184 | else: 185 | X = np.where(cmpN3 == v)[0] 186 | if(len(X)>0): 187 | x = X[0] 188 | if x > 0: 189 | i = 2 190 | else: 191 | X = np.where(cmpN4 == v)[0] 192 | if(len(X)>0): 193 | x = X[0] 194 | if x > 0: 195 | i = 3 196 | i += x*4 197 | 198 | if(x > 0): 199 | pos = i 200 | fTbl = findFunctionTable(i,relocSectionData) 201 | if not fTbl is None: 202 | fTblStore = findFunctionTblStore(i,relocSectionData) 203 | conn.execute('INSERT INTO function_reference_cache (s,offset) VALUES (?,?)', (s,pos)) 204 | conn.execute('INSERT INTO function_table_pointers_cache (s,voffset) VALUES (?,?)', (s,fTbl)) 205 | conn.execute('INSERT INTO function_table_pointers_store_cache (s,voffset) VALUES (?,?)', (s,fTblStore)) 206 | conn.commit() 207 | if(fTblStore is None): 208 | print("\"%s\",0x%016x," % (s,fTbl)) 209 | else: 210 | print("\"%s\",0x%016x,0x%016x" % (s,fTbl,fTblStore)) 211 | sys.stdout.flush() 212 | 213 | -------------------------------------------------------------------------------- /010 Templates/MHWGui.bt: -------------------------------------------------------------------------------- 1 | //------------------------------------------------ 2 | //--- 010 Editor v8.0.1 Binary Template 3 | // 4 | // File: 5 | // Authors: CrazyT 6 | // Version: 7 | // Purpose: 8 | // Category: 9 | // File Mask: *.gui 10 | // ID Bytes: 11 | // History: 12 | //------------------------------------------------ 13 | SetForeColor(0xffffff); 14 | 15 | struct PropertiesVal; 16 | struct Object; 17 | struct SubUI; 18 | struct UnknStruct; 19 | struct UnknStruct2; 20 | struct UnknStruct3; 21 | 22 | struct Head{ 23 | uint signature ; 24 | uint unkn1; 25 | uint size; 26 | ubyte unkn2[32]; 27 | uint unknStruct3Count; 28 | uint objCount; 29 | ubyte unkn3[4]; 30 | uint count; 31 | uint unknStructCount; 32 | uint unkn4; 33 | uint unknStruct2Count; 34 | uint textRefCount; 35 | ubyte unkn4_[36]; 36 | uint subuiCount; 37 | ubyte unkn5[12]; 38 | uint unknUiCount; 39 | ubyte unkn6[36]; 40 | uint unknStructOff3; 41 | ubyte unkn8[12]; 42 | uint objectOff; 43 | ubyte unkn9[12]; 44 | uint propertiesValArrayOff ; 45 | uint unkn10; 46 | uint64 unknStructOff; 47 | uint64 unknStructOff2; 48 | uint64 startEnd; 49 | uint64 unkn; 50 | uint64 subUI[9]; 51 | uint64 unkUI[4]; 52 | ubyte unkn13[16]; 53 | uint propertiesTextArrayOff ; 54 | uint unkn14[12]; 55 | uint unkn15; 56 | uint floatArrOff ; 57 | uint unkn16[3]; 58 | } head ; 59 | 60 | struct UnknUI{ 61 | uint id; 62 | uint unkn1[3]; 63 | uint suiToff; 64 | local int suipos = FTell(); 65 | local int textPos = head.propertiesTextArrayOff+suiToff; 66 | FSeek(textPos); 67 | char suiText[]; 68 | FSeek(suipos); 69 | uint unkn2; 70 | }; 71 | 72 | struct TextRef{ 73 | uint id; 74 | uint unkn1[3]; 75 | uint suiToff; 76 | uint unkn2[3]; 77 | local int suipos = FTell(); 78 | local int textPos = head.propertiesTextArrayOff+suiToff; 79 | FSeek(textPos); 80 | char text[]; 81 | FSeek(suipos); 82 | }; 83 | 84 | string PropertiesValRead(PropertiesVal &v){ 85 | if(v.type==7){ 86 | return v.text + " \"" + v.vStr+"\""; 87 | }else{ 88 | return v.text; 89 | } 90 | } 91 | string ObjectRead(Object &v){ 92 | return v.text; 93 | } 94 | string SubUIRead(SubUI &v){ 95 | return v.suiText2 + " \"" + v.suiText + "\""; 96 | } 97 | string UnknUIRead(UnknUI &v){ 98 | return "\"" + v.suiText + "\""; 99 | } 100 | string TextRefRead(TextRef &v){ 101 | return v.text; 102 | } 103 | string UnknStructRead(UnknStruct &v){ 104 | return v.text; 105 | } 106 | string UnknStruct2Read(UnknStruct2 &v){ 107 | string s; 108 | SPrintf( s, "%d", (int)v.id ); 109 | return s+": "+v.text; 110 | } 111 | string UnknStruct3Read(UnknStruct3 &v){ 112 | string s; 113 | SPrintf( s, "%d", (int)v.id ); 114 | return s+": "+v.text; 115 | } 116 | struct StartEnd{ 117 | local int i; 118 | for(i=0;i; 120 | } 121 | }; 122 | struct SubUI{ 123 | uint id; 124 | ubyte unkn1[44]; 125 | uint suiToff; 126 | local int suipos = FTell(); 127 | local int textPos = head.propertiesTextArrayOff+suiToff; 128 | FSeek(textPos); 129 | char suiText[]; 130 | FSeek(suipos); 131 | uint unkn1; 132 | uint suiToff2; 133 | local int suipos2 = FTell(); 134 | local int textPos2 = head.propertiesTextArrayOff+suiToff2; 135 | FSeek(textPos2); 136 | char suiText2[]; 137 | FSeek(suipos2); 138 | uint unkn2; 139 | }; 140 | struct Object (uint currentProp){ 141 | local int cp = currentProp; 142 | uint id; 143 | ubyte propertyCount; 144 | ubyte unkn1[3]; 145 | uint unkn2; 146 | uint unkn3; 147 | uint toff; 148 | local int pos2 = FTell(); 149 | FSeek(head.propertiesTextArrayOff+toff); 150 | char text[]; 151 | FSeek(pos2); 152 | uint unkn4; 153 | uint unkn5 ; 154 | ubyte unkn6[28]; 155 | 156 | local int pos3 = FTell(); 157 | FSeek(propertiesValOff[currentProp]); 158 | struct ObjectProperties{ 159 | local int i; 160 | for(i=0;i; 162 | } 163 | } objectProperties; 164 | FSeek(pos3); 165 | }; 166 | 167 | struct PropertiesVal{ 168 | uint type; 169 | uint unkn1[3]; 170 | uint toff; 171 | uint unkn2; 172 | if(type==7){ 173 | local int pos1 = FTell()+4; 174 | local int j = 0; 175 | uint v; 176 | FSeek(head.propertiesTextArrayOff); 177 | for(j=0;j = FTell(); 204 | FSeek(head.propertiesTextArrayOff+toff); 205 | char text[]; 206 | FSeek(pos1); 207 | uint unkn7; 208 | uint unkn8; 209 | uint unkn9; 210 | uint maybeTextOff; 211 | uint unkn11; 212 | 213 | }; 214 | struct UnknStruct2{ 215 | uint id; 216 | uint unkn2; 217 | uint unkn3; 218 | uint unkn4; 219 | uint unkn5; 220 | uint unkn6; 221 | uint toff; 222 | local int pos1 = FTell(); 223 | local int atoff = head.propertiesTextArrayOff+toff; 224 | FSeek(atoff); 225 | char text[]; 226 | FSeek(pos1); 227 | uint unkn7; 228 | uint unkn8; 229 | uint unkn9; 230 | uint unknOff; 231 | uint unkn11[3]; 232 | 233 | }; 234 | struct UnknStruct3{ 235 | uint id; 236 | uint unkn2; 237 | uint toff; 238 | local int pos1 = FTell(); 239 | local int atoff = head.propertiesTextArrayOff+toff; 240 | FSeek(atoff); 241 | char text[]; 242 | FSeek(pos1); 243 | uint unkn3; 244 | }; 245 | local int i; 246 | 247 | local int propertiesValOff[head.count]; 248 | FSeek(head.propertiesValArrayOff); 249 | struct Properties{ 250 | for(i=0;i; 253 | } 254 | } allProperties; 255 | 256 | FSeek(head.objectOff); 257 | struct Objects{ 258 | local int currentProp = 0; 259 | for(i=0;i; 261 | currentProp += object.propertyCount; 262 | } 263 | } objects; 264 | 265 | 266 | 267 | local int x; 268 | FSeek(head.startEnd); 269 | 270 | StartEnd startEnd; 271 | 272 | //TODO ... this does not seem right 273 | struct SubuiArr{ 274 | for(x=0;x<9;x++){ 275 | FSeek(head.subUI[x]); 276 | struct SubUIs{ 277 | for(i=0;i; 279 | } 280 | }subuis ; 281 | } 282 | }subuiarr; 283 | 284 | for(x=0;x<4;x++){ 285 | FSeek(head.unkUI[x]); 286 | struct UnkUIs{ 287 | for(i=0;i; 289 | } 290 | }unknuis ; 291 | } 292 | 293 | FSeek(head.unknStructOff); 294 | struct UnknStructs{ 295 | for(i=0;i; 297 | } 298 | }unknStructs1; 299 | 300 | FSeek(head.unknStructOff2); 301 | struct UnknStructs2{ 302 | for(i=0;i; 304 | } 305 | }unknStructs2; 306 | 307 | FSeek(head.unknStructOff3); 308 | struct UnknStructs3{ 309 | uint unkn[16]; 310 | for(i=0;i; 312 | } 313 | }unknStructs3; 314 | 315 | FSeek(head.floatArrOff); 316 | if(head.floatArrOff!=head.size){ 317 | struct FloatArr{ 318 | float f[(head.size-head.floatArrOff)/4]; 319 | }floatArr; 320 | } -------------------------------------------------------------------------------- /010 Templates/Shader.bt: -------------------------------------------------------------------------------- 1 | //-------------------------------------- 2 | //--- 010 Editor v6.0.1 Binary Template 3 | // 4 | // File: 5 | // Author: CrazyT 6 | // Revision: 7 | // Purpose: 8 | // File Mask: *.sdf 9 | //-------------------------------------- 10 | 11 | struct MeshBlock; 12 | struct BlockRef; 13 | struct Material; 14 | struct UnknStructData; 15 | struct UnknStructDataSub; 16 | struct UnknStruct2Sub; 17 | struct ShaderData; 18 | struct ShaderDataShort; 19 | string readBlock(MeshBlock &b); 20 | string readSub(UnknStructDataSub &sub); 21 | string readUnkn4(uint64 unkn4); 22 | string readUnknStruct2(UnknStruct2Sub &v); 23 | 24 | //Offset of: 25 | //4E 6F 72 6D 61 6C 00 54 61 6E 67 65 6E 74 00 55 56 5F 50 72 69 6D 61 72 79 00 55 56 5F 53 65 63 6F 6E 64 61 72 79 00 57 65 69 67 68 74 00 57 65 69 67 68 74 00 4A 6F 69 6E 74 00 4A 6F 69 6E 74 00 43 6F 6C 6F 72 00 50 6F 73 69 74 69 6F 6e 50 46 00 49 41 53 6b 69 6e 38 77 74 32 55 56 00 50 6f 73 69 74 69 6f 6e 00 26 | //=0xaae2d85 27 | //-0x6f6c85 (next val of blocktype 0x81F58067 in ShaderPackageIntel.sdf) = 0xA3EC100 28 | //local uint32 textsOffset = 0xA3EC100; 29 | //local uint32 blockStart = 0x9bf9618; 30 | //local uint32 materialStart = 0x4510c; 31 | 32 | //CRC hash-sums seem to be CRC-32/JAMCRC or atleast similar to it. 33 | 34 | struct Property1{ 35 | uint64 stringPointer; 36 | union FlagsU1{ 37 | struct Flags1{ 38 | uint64 unkn : 20; 39 | uint64 index : 8; 40 | uint64 unkn1 : 20; 41 | uint64 unkn2 : 16; 42 | } data; 43 | uint64 val; 44 | }flags; 45 | local uint64 realStringPointer; 46 | realStringPointer=stringPointer+head.textsOffset; 47 | local uint64 curPos = FTell(); 48 | FSeek(realStringPointer); 49 | string text; 50 | FSeek(curPos); 51 | } ; 52 | struct Property2{ 53 | uint64 stringPointer; 54 | union FlagsU2{ 55 | struct Flags2{ 56 | uint32 unkn : 14; 57 | uint32 index : 6; 58 | uint32 unkn1 : 32-14-6; 59 | } data; 60 | uint32 val; 61 | }flags; 62 | //for example (zlib.crc32("Position".encode()) ^ 0xffffffff) & 0x7fffffff 63 | uint nameHash : 32; 64 | local uint64 realStringPointer; 65 | realStringPointer=stringPointer+head.textsOffset; 66 | local uint64 curPos = FTell(); 67 | FSeek(realStringPointer); 68 | string text; 69 | FSeek(curPos); 70 | } ; 71 | struct UnknStruct2Sub{ 72 | uint32 pos; 73 | local uint32 oldpos = FTell(); 74 | FSeek(pos+head.textsOffset); 75 | string text; 76 | FSeek(oldpos); 77 | uint32 unkn2; 78 | uint16 unkn3; 79 | uint16 unkn4; 80 | uint32 unkn5; 81 | }; 82 | struct UnknStruct2{ 83 | uint32 count; 84 | uint32 unkn1; 85 | //UnknStruct2Sub sub[count]; 86 | Property2 props[count]; 87 | uint32 empty[64-count*4]; 88 | }; 89 | struct UnknStructDataSub{ 90 | uint32 hdata[4]; 91 | uint64 pos; 92 | local uint32 oldpos = FTell(); 93 | FSeek(pos+head.textsOffset); 94 | string text; 95 | FSeek(oldpos); 96 | uint32 data[2]; 97 | }; 98 | struct UnknStructData{ 99 | uint64 pos; 100 | local uint32 oldpos = FTell(); 101 | FSeek(pos+head.textsOffset); 102 | string text; 103 | FSeek(oldpos); 104 | uint32 data1; 105 | //for example (zlib.crc32("SSVRLinear".encode()) ^ 0xffffffff) & 0x7fffffff 106 | uint32 uniqueId; 107 | uint32 data2; 108 | uint32 countSubElements; 109 | if(countSubElements>0){ 110 | UnknStructDataSub sub[countSubElements]; 111 | } 112 | }; 113 | struct BlockRef{ 114 | uint64 pos; 115 | local uint64 curPos = FTell(); 116 | FSeek(pos); 117 | MeshBlock b; 118 | FSeek(curPos); 119 | }; 120 | string readShaderData(ShaderData &v){ 121 | string res =""; 122 | SPrintf( res, "%s",v.text ); 123 | return res; 124 | } 125 | 126 | string readUnknStruct2(UnknStruct2Sub &v){ 127 | string res =""; 128 | SPrintf( res, "%s",v.text ); 129 | return res; 130 | } 131 | string readSub(UnknStructDataSub &sub){ 132 | string res =""; 133 | SPrintf( res, "%s",sub.text ); 134 | return res; 135 | } 136 | string readUnknStructData(UnknStructData &d){ 137 | string s =""; 138 | SPrintf( s, "%08x - %s", d.uniqueId,d.text ); 139 | return s; 140 | } 141 | string readUnkn4(uint64 unkn4){ 142 | string s =""; 143 | if((unkn4!=0)&&(unkn4!=0xFFFFFFFF)){ 144 | SPrintf( s, "[%016lx] %s", unkn4+head.textsOffset,ReadString(unkn4+head.textsOffset) ); 145 | } 146 | return s; 147 | } 148 | string readMaterial(Material &m){ 149 | string s; 150 | SPrintf( s, "%08x - %s", m.shaderHash,m.nameStr ); 151 | return s; 152 | } 153 | string readProp1(Property1 &p){ 154 | string s; 155 | //SPrintf( s, "%s(%016lx)", ReadString(p.stringPointer+head.textsOffset),p.unkn ); 156 | SPrintf( s, "(index:%3d offset:%3d flags.val:%08x%08x) %s", p.flags.data.index,p.flags.data.index*4,p.flags.val>>32,p.flags.val,p.text ); 157 | return s; 158 | } 159 | string readProp2(Property2 &p){ 160 | string s; 161 | //SPrintf( s, "%s(%016lx)", ReadString(p.stringPointer+head.textsOffset),p.unkn ); 162 | SPrintf( s, "(index:%3d offset:%3d flags.val:%08x%08x) %s", p.flags.data.index, p.flags.data.index*4,p.flags.val>>32,p.flags.val,p.text ); 163 | return s; 164 | } 165 | 166 | string readBlock(MeshBlock &b){ 167 | string s; 168 | SPrintf( s, " %08x - %s", b.blocktype ,b.nameStr); 169 | return s; 170 | } 171 | string readBlockRef(BlockRef &b){ 172 | return readBlock(b.b); 173 | } 174 | string readShaderString(short s){ 175 | string str; 176 | if(s<0){ 177 | SPrintf( str, "%d",s); 178 | return str; 179 | } 180 | SPrintf( str, "%d %s",s,shaderDatas.shaderData[s].text); 181 | return str; 182 | } 183 | 184 | struct Head{ 185 | uint32 tag; 186 | uint32 unkn1; 187 | uint32 unknStruct1Count; 188 | uint32 materialCount; 189 | uint32 shaderCount; 190 | uint32 unkn2; 191 | uint32 blockCount; 192 | uint32 unknStruct2Count; 193 | uint32 unknStruct3Count; 194 | uint32 unknStruct4Count; 195 | uint32 unkn3[2]; 196 | uint32 unknStruct1Offset; 197 | uint32 unkn5; 198 | uint64 materialOffset; 199 | uint64 shaderOffset; 200 | uint64 blockOffset; 201 | uint64 unknStruct2Offset; 202 | uint64 unknStruct3Offset; 203 | uint64 unknStruct4Offset; 204 | uint64 unknStruct5Offset; 205 | uint64 textsOffset; 206 | uint64 unkn7; 207 | }; 208 | struct BlockHead{ 209 | BlockRef bref[head.blockCount]; 210 | }; 211 | struct MeshBlock{ 212 | uint64 name; 213 | local uint64 curPos = FTell(); 214 | FSeek(name+head.textsOffset); 215 | string nameStr; 216 | FSeek(curPos); 217 | uint32 unkn2; 218 | //blocktype is actually just the hash of the name 219 | //for example (zlib.crc32("IANonSkin1UV".encode()) ^ 0xffffffff) & 0x7fffffff 220 | uint32 blocktype; 221 | short propCount; 222 | //props seem to contain indexes for used props 223 | //that (lastpropnum+1)*4 seems to match vertexStructSize 224 | //for example: 225 | // UV_Primary(0000000000501080) 226 | // will result in (5+1)*4 = 24 227 | //still unshure how to decode type 228 | short vertexStructSize; 229 | uint32 unkn4; 230 | Property1 props[propCount]; 231 | }; 232 | struct MaterialHead{ 233 | uint32 unkn1; 234 | uint32 unkn2; 235 | uint32 unkn3; 236 | uint32 unkn4; 237 | }; 238 | struct Material{ 239 | short vertexShaderDataIdx; 240 | short pixelShaderDataIdx; 241 | uint32 unkn3; 242 | short unkn4; 243 | short shaderDataIdx2; 244 | uint16 unknStruct2Idx; 245 | uint16 unkn7; 246 | uint32 name; 247 | local uint64 curPos = FTell(); 248 | FSeek(name+head.textsOffset); 249 | string nameStr; 250 | FSeek(curPos); 251 | uint32 unkn8[2]; 252 | //for example (zlib.crc32("GpuRibbonFireVolume".encode()) ^ 0xffffffff) & 0x7fffffff 253 | uint32 shaderHash; 254 | }; 255 | struct ShaderData{ 256 | uint64 pos; 257 | uint32 length; 258 | local uint32 oldpos = FTell(); 259 | FSeek(pos); 260 | ubyte data[length]; 261 | FSeek(oldpos); 262 | uint32 unkn2; 263 | uint64 unkn3; 264 | uint64 unkn4; 265 | uint64 unkn5; 266 | uint32 pos2; 267 | local uint32 oldpos2 = FTell(); 268 | FSeek(pos2+head.textsOffset); 269 | string text; 270 | FSeek(oldpos2); 271 | uint32 unkn7; 272 | uint32 unkn8; 273 | ushort unkn9; 274 | ushort unkn10; 275 | }; 276 | struct ShaderDataShort{ 277 | uint64 pos; 278 | uint32 length; 279 | local uint32 oldpos = FTell(); 280 | FSeek(pos); 281 | ubyte data[length]; 282 | FSeek(oldpos); 283 | uint32 unkn2; 284 | uint64 unkn3; 285 | uint64 unkn4; 286 | uint64 unkn5; 287 | 288 | }; 289 | Head head; 290 | FSeek(head.unknStruct1Offset); 291 | uint64 unknStruct1[head.unknStruct1Count]; 292 | 293 | struct{ 294 | local int i; 295 | for(i=0;i; 298 | } 299 | }unknStruct1Datas; 300 | 301 | FSeek(head.blockOffset); 302 | struct{ 303 | BlockHead blockHead; 304 | //FSeek(blockStart); 305 | MeshBlock meshBlock[head.blockCount]; 306 | } meshBlocks; 307 | 308 | FSeek(head.unknStruct2Offset); 309 | struct{ 310 | UnknStruct2 unknStruct2[head.unknStruct2Count]; 311 | }unknStruct2s; 312 | 313 | FSeek(head.materialOffset); 314 | struct{ 315 | MaterialHead materialHead; 316 | Material material[head.materialCount]; 317 | } materials; 318 | 319 | //maybe also helpful: 320 | // https://github.com/tgjones/slimshader 321 | // http://timjones.io/blog/archive/2015/09/02/parsing-direct3d-shader-bytecode 322 | FSeek(head.shaderOffset+0x10); 323 | struct{ 324 | ShaderData shaderData[head.shaderCount-1]; 325 | ShaderDataShort shaderDataShort; 326 | } shaderDatas; 327 | 328 | FSeek(head.unknStruct3Offset); 329 | struct{ 330 | struct{ 331 | uint64 unkn1; 332 | uint64 unkn2; 333 | uint64 unknOffset3; 334 | }unkn[head.unknStruct3Count]; 335 | }unknStruct3; 336 | 337 | FSeek(head.unknStruct4Offset); 338 | struct{ 339 | struct{ 340 | uint64 unkn1; 341 | uint64 unkn2; 342 | uint64 unkn3; 343 | uint64 unknOffset4; 344 | uint64 unkn5; 345 | }unkn[head.unknStruct4Count]; 346 | uint64 unkn; 347 | }unknStruct4; 348 | 349 | FSeek(head.unknStruct5Offset); 350 | struct{ 351 | uint64 unkn[180]; 352 | }unknStruct5; 353 | 354 | FSeek(unknStruct3.unkn[0].unknOffset3); 355 | struct{ 356 | local uint32 i; 357 | for(i=0;i; 363 | } 364 | } 365 | }unknStruct3_; 366 | 367 | FSeek(unknStruct4.unkn[0].unknOffset4); 368 | struct{ 369 | local uint32 i; 370 | for(i=0;i; 375 | }unkn; 376 | } 377 | } 378 | }unknStruct4_; 379 | -------------------------------------------------------------------------------- /010 Templates/IBShader.bt: -------------------------------------------------------------------------------- 1 | //-------------------------------------- 2 | //--- 010 Editor v6.0.1 Binary Template 3 | // 4 | // File: 5 | // Author: CrazyT 6 | // Revision: 7 | // Purpose: 8 | // File Mask: *.sdf 9 | //-------------------------------------- 10 | 11 | struct MeshBlock; 12 | struct BlockRef; 13 | struct Material; 14 | struct UnknStructData; 15 | struct UnknStructDataSub; 16 | struct UnknStruct2Sub; 17 | struct ShaderData; 18 | struct ShaderDataShort; 19 | string readBlock(MeshBlock &b); 20 | string readSub(UnknStructDataSub &sub); 21 | string readUnkn4(uint64 unkn4); 22 | string readUnknStruct2(UnknStruct2Sub &v); 23 | 24 | //Offset of: 25 | //4E 6F 72 6D 61 6C 00 54 61 6E 67 65 6E 74 00 55 56 5F 50 72 69 6D 61 72 79 00 55 56 5F 53 65 63 6F 6E 64 61 72 79 00 57 65 69 67 68 74 00 57 65 69 67 68 74 00 4A 6F 69 6E 74 00 4A 6F 69 6E 74 00 43 6F 6C 6F 72 00 50 6F 73 69 74 69 6F 6e 50 46 00 49 41 53 6b 69 6e 38 77 74 32 55 56 00 50 6f 73 69 74 69 6f 6e 00 26 | //=0xaae2d85 27 | //-0x6f6c85 (next val of blocktype 0x81F58067 in ShaderPackageIntel.sdf) = 0xA3EC100 28 | //local uint32 textsOffset = 0xA3EC100; 29 | //local uint32 blockStart = 0x9bf9618; 30 | //local uint32 materialStart = 0x4510c; 31 | 32 | //CRC hash-sums seem to be CRC-32/JAMCRC or atleast similar to it. 33 | 34 | struct Property1{ 35 | uint64 stringPointer; 36 | union FlagsU1{ 37 | struct Flags1{ 38 | uint64 unkn : 20; 39 | uint64 index : 8; 40 | uint64 unkn1 : 20; 41 | uint64 unkn2 : 16; 42 | } data; 43 | uint64 val; 44 | }flags; 45 | local uint64 realStringPointer; 46 | realStringPointer=stringPointer+head.textsOffset; 47 | local uint64 curPos = FTell(); 48 | FSeek(realStringPointer); 49 | string text; 50 | FSeek(curPos); 51 | } ; 52 | struct Property2{ 53 | uint64 stringPointer; 54 | union FlagsU2{ 55 | struct Flags2{ 56 | uint32 unkn : 14; 57 | uint32 index : 6; 58 | uint32 unkn1 : 32-14-6; 59 | } data; 60 | uint32 val; 61 | }flags; 62 | //for example (zlib.crc32("Position".encode()) ^ 0xffffffff) & 0x7fffffff 63 | uint nameHash : 32; 64 | local uint64 realStringPointer; 65 | realStringPointer=stringPointer+head.textsOffset; 66 | local uint64 curPos = FTell(); 67 | FSeek(realStringPointer); 68 | string text; 69 | FSeek(curPos); 70 | } ; 71 | struct UnknStruct2Sub{ 72 | uint32 pos; 73 | local uint32 oldpos = FTell(); 74 | FSeek(pos+head.textsOffset); 75 | string text; 76 | FSeek(oldpos); 77 | uint32 unkn2; 78 | uint16 unkn3; 79 | uint16 unkn4; 80 | uint32 unkn5; 81 | }; 82 | struct UnknStruct2{ 83 | uint32 count; 84 | uint32 unkn1; 85 | //UnknStruct2Sub sub[count]; 86 | Property2 props[count]; 87 | uint32 empty[64-count*4]; 88 | }; 89 | struct UnknStructDataSub{ 90 | uint32 hdata[4]; 91 | uint64 pos; 92 | local uint32 oldpos = FTell(); 93 | FSeek(pos+head.textsOffset); 94 | string text; 95 | FSeek(oldpos); 96 | uint32 data[2]; 97 | }; 98 | struct UnknStructData{ 99 | uint64 pos; 100 | local uint32 oldpos = FTell(); 101 | FSeek(pos+head.textsOffset); 102 | string text; 103 | FSeek(oldpos); 104 | uint32 data1; 105 | //for example (zlib.crc32("SSVRLinear".encode()) ^ 0xffffffff) & 0x7fffffff 106 | uint32 uniqueId; 107 | uint32 data2; 108 | uint32 countSubElements; 109 | if(countSubElements>0){ 110 | UnknStructDataSub sub[countSubElements]; 111 | } 112 | }; 113 | struct BlockRef{ 114 | uint64 pos; 115 | local uint64 curPos = FTell(); 116 | FSeek(pos); 117 | MeshBlock b; 118 | FSeek(curPos); 119 | }; 120 | string readShaderData(ShaderData &v){ 121 | string res =""; 122 | SPrintf( res, "%s",v.text ); 123 | return res; 124 | } 125 | 126 | string readUnknStruct2(UnknStruct2Sub &v){ 127 | string res =""; 128 | SPrintf( res, "%s",v.text ); 129 | return res; 130 | } 131 | string readSub(UnknStructDataSub &sub){ 132 | string res =""; 133 | SPrintf( res, "%s",sub.text ); 134 | return res; 135 | } 136 | string readUnknStructData(UnknStructData &d){ 137 | string s =""; 138 | SPrintf( s, "%08x - %s", d.uniqueId,d.text ); 139 | return s; 140 | } 141 | string readUnkn4(uint64 unkn4){ 142 | string s =""; 143 | if((unkn4!=0)&&(unkn4!=0xFFFFFFFF)){ 144 | SPrintf( s, "[%016lx] %s", unkn4+head.textsOffset,ReadString(unkn4+head.textsOffset) ); 145 | } 146 | return s; 147 | } 148 | string readMaterial(Material &m){ 149 | string s; 150 | SPrintf( s, "%08x - %s", m.shaderHash,m.nameStr ); 151 | return s; 152 | } 153 | string readProp1(Property1 &p){ 154 | string s; 155 | //SPrintf( s, "%s(%016lx)", ReadString(p.stringPointer+head.textsOffset),p.unkn ); 156 | SPrintf( s, "(index:%3d offset:%3d flags.val:%08x%08x) %s", p.flags.data.index,p.flags.data.index*4,p.flags.val>>32,p.flags.val,p.text ); 157 | return s; 158 | } 159 | string readProp2(Property2 &p){ 160 | string s; 161 | //SPrintf( s, "%s(%016lx)", ReadString(p.stringPointer+head.textsOffset),p.unkn ); 162 | SPrintf( s, "(index:%3d offset:%3d flags.val:%08x%08x) %s", p.flags.data.index, p.flags.data.index*4,p.flags.val>>32,p.flags.val,p.text ); 163 | return s; 164 | } 165 | 166 | string readBlock(MeshBlock &b){ 167 | string s; 168 | SPrintf( s, " %08x - %s", b.blocktype ,b.nameStr); 169 | return s; 170 | } 171 | string readBlockRef(BlockRef &b){ 172 | return readBlock(b.b); 173 | } 174 | string readShaderString(short s){ 175 | string str; 176 | if(s<0){ 177 | SPrintf( str, "%d",s); 178 | return str; 179 | } 180 | SPrintf( str, "%d %s",s,shaderDatas.shaderData[s].text); 181 | return str; 182 | } 183 | 184 | struct Head{ 185 | uint32 tag; 186 | uint32 unkn1; 187 | uint32 unknStruct1Count; 188 | uint32 materialCount; 189 | uint32 shaderCount; 190 | uint32 unkn2; 191 | uint32 blockCount; 192 | uint32 unknStruct2Count; 193 | uint32 unknStruct3Count; 194 | uint32 unknStruct4Count; 195 | uint32 unkn3[4]; 196 | uint32 unknStruct1Offset; 197 | uint32 unkn5; 198 | uint64 materialOffset; 199 | uint64 shaderOffset; 200 | uint64 blockOffset; 201 | uint64 unknStruct2Offset; 202 | uint64 unknStruct3Offset; 203 | uint64 unknStruct4Offset; 204 | uint64 unknStruct5Offset; 205 | uint64 textsOffset; 206 | uint64 unkn7; 207 | }; 208 | struct BlockHead{ 209 | BlockRef bref[head.blockCount]; 210 | }; 211 | struct MeshBlock{ 212 | uint64 name; 213 | local uint64 curPos = FTell(); 214 | FSeek(name+head.textsOffset); 215 | string nameStr; 216 | FSeek(curPos); 217 | uint32 unkn2; 218 | //blocktype is actually just the hash of the name 219 | //for example (zlib.crc32("IANonSkin1UV".encode()) ^ 0xffffffff) & 0x7fffffff 220 | uint32 blocktype; 221 | short propCount; 222 | //props seem to contain indexes for used props 223 | //that (lastpropnum+1)*4 seems to match vertexStructSize 224 | //for example: 225 | // UV_Primary(0000000000501080) 226 | // will result in (5+1)*4 = 24 227 | //still unshure how to decode type 228 | short vertexStructSize; 229 | uint32 unkn4; 230 | Property1 props[propCount]; 231 | }; 232 | struct MaterialHead{ 233 | uint32 unkn1; 234 | uint32 unkn2; 235 | uint32 unkn3; 236 | uint32 unkn4; 237 | }; 238 | struct Material{ 239 | short vertexShaderDataIdx; 240 | short pixelShaderDataIdx; 241 | uint32 unkn3; 242 | short unkn4; 243 | short shaderDataIdx2; 244 | uint16 unknStruct2Idx; 245 | uint16 unkn7; 246 | uint32 name; 247 | local uint64 curPos = FTell(); 248 | FSeek(name+head.textsOffset); 249 | string nameStr; 250 | FSeek(curPos); 251 | uint32 unkn8[2]; 252 | //for example (zlib.crc32("GpuRibbonFireVolume".encode()) ^ 0xffffffff) & 0x7fffffff 253 | uint32 shaderHash; 254 | }; 255 | struct ShaderData{ 256 | uint64 pos; 257 | uint32 length; 258 | local uint32 oldpos = FTell(); 259 | FSeek(pos); 260 | ubyte data[length]; 261 | FSeek(oldpos); 262 | uint32 unkn2; 263 | uint64 unkn3; 264 | uint64 unkn4; 265 | uint64 unkn5; 266 | uint64 unkn6; 267 | uint64 unkn7; 268 | uint64 unkn8; 269 | uint32 pos2; 270 | local uint32 oldpos2 = FTell(); 271 | FSeek(pos2+head.textsOffset); 272 | string text; 273 | FSeek(oldpos2); 274 | uint32 unkn9; 275 | uint32 unkn10; 276 | ushort unkn11; 277 | ushort unkn12; 278 | }; 279 | struct ShaderDataShort{ 280 | uint64 pos; 281 | uint32 length; 282 | local uint32 oldpos = FTell(); 283 | FSeek(pos); 284 | ubyte data[length]; 285 | FSeek(oldpos); 286 | uint32 unkn2; 287 | uint64 unkn3; 288 | uint64 unkn4; 289 | uint64 unkn5; 290 | 291 | }; 292 | Head head; 293 | FSeek(head.unknStruct1Offset); 294 | uint64 unknStruct1[head.unknStruct1Count]; 295 | 296 | struct{ 297 | local int i; 298 | for(i=0;i; 301 | } 302 | }unknStruct1Datas; 303 | 304 | FSeek(head.blockOffset); 305 | struct{ 306 | BlockHead blockHead; 307 | //FSeek(blockStart); 308 | MeshBlock meshBlock[head.blockCount]; 309 | } meshBlocks; 310 | 311 | FSeek(head.unknStruct2Offset); 312 | struct{ 313 | UnknStruct2 unknStruct2[head.unknStruct2Count]; 314 | }unknStruct2s; 315 | 316 | FSeek(head.materialOffset); 317 | struct{ 318 | MaterialHead materialHead; 319 | Material material[head.materialCount]; 320 | } materials; 321 | 322 | //maybe also helpful: 323 | // https://github.com/tgjones/slimshader 324 | // http://timjones.io/blog/archive/2015/09/02/parsing-direct3d-shader-bytecode 325 | FSeek(head.shaderOffset+0x10); 326 | struct{ 327 | ShaderData shaderData[head.shaderCount-1]; 328 | ShaderDataShort shaderDataShort; 329 | } shaderDatas; 330 | 331 | FSeek(head.unknStruct3Offset); 332 | struct{ 333 | struct{ 334 | uint64 unkn1; 335 | uint64 unkn2; 336 | uint64 unknOffset3; 337 | }unkn[head.unknStruct3Count]; 338 | }unknStruct3; 339 | 340 | FSeek(head.unknStruct4Offset); 341 | struct{ 342 | struct{ 343 | uint64 unkn1; 344 | uint64 unkn2; 345 | uint64 unkn3; 346 | uint64 unknOffset4; 347 | uint64 unkn5; 348 | }unkn[head.unknStruct4Count]; 349 | uint64 unkn; 350 | }unknStruct4; 351 | 352 | FSeek(head.unknStruct5Offset); 353 | struct{ 354 | uint64 unkn[180]; 355 | }unknStruct5; 356 | 357 | FSeek(unknStruct3.unkn[0].unknOffset3); 358 | struct{ 359 | local uint32 i; 360 | for(i=0;i; 366 | } 367 | } 368 | }unknStruct3_; 369 | 370 | FSeek(unknStruct4.unkn[0].unknOffset4); 371 | struct{ 372 | local uint32 i; 373 | for(i=0;i; 378 | }unkn; 379 | } 380 | } 381 | }unknStruct4_; -------------------------------------------------------------------------------- /010 Templates/DXBC.bt: -------------------------------------------------------------------------------- 1 | //-------------------------------------- 2 | //--- 010 Editor v6.0.1 Binary Template 3 | // 4 | // File: 5 | // Author: 6 | // File Mask: *.shdr 7 | // Revision: 8 | // Purpose: 9 | //-------------------------------------- 10 | 11 | // Most stuff ported/stolen from https://github.com/GPUOpen-Tools/common-src-ShaderUtils/ 12 | 13 | /// The top-level header for a D3D10 shader. 14 | struct CB; 15 | struct RB; 16 | struct Constant; 17 | struct SubConstant; 18 | struct Type; 19 | 20 | 21 | string readString(uint spos); 22 | string readStringWithPos(uint spos); 23 | 24 | string readType(Type& v){ 25 | return readString(v.dwNameOffset); 26 | } 27 | string readSubConstant(SubConstant& v){ 28 | string s; 29 | SPrintf(s,"%s %s",readString(v.type.dwNameOffset),readString(v.dwNameOffset)); 30 | return s; 31 | } 32 | string readConstant(Constant& v){ 33 | string s; 34 | SPrintf(s,"%s %s",readString(v.D3D10_Type.dwNameOffset),readString(v.dwNameOffset)); 35 | return s; 36 | } 37 | string readCB(CB& v){ 38 | return readString(v.dwNameOffset); 39 | } 40 | string readRB(RB& v){ 41 | return readString(v.dwNameOffset); 42 | } 43 | string readString(uint spos){ 44 | local string text = ReadString(D3D11_RDEF_Header.pos+spos); 45 | local string res; 46 | res = text; 47 | return res; 48 | } 49 | string readStringWithPos(uint spos){ 50 | local string text = ReadString(D3D11_RDEF_Header.pos+spos); 51 | local string res; 52 | SPrintf(res,"%d %s",spos,text); 53 | return res; 54 | } 55 | DWORD TO_DWORD(char s[]){ 56 | local DWORD a = s[0]; 57 | local DWORD b = s[1]; 58 | local DWORD c = s[2]; 59 | local DWORD d = s[3]; 60 | 61 | return (d<<24)|(c<<16)|(b<<8)|(a); 62 | } 63 | local DWORD RDEF = TO_DWORD("RDEF"); 64 | SetBackColor(cBlue); 65 | struct 66 | { 67 | DWORD dwMagicNumber; ///< A FourCC value. Always set to "DXBC". 68 | DWORD dwCheckSum[4]; ///< A MD5-based (but with differences) checksum. See DXBCChecksum.h for further details. 69 | DWORD dwReserved; ///< Unknown. Seems always to be 00000001. 70 | DWORD dwSize; ///< The size of the shader object. 71 | DWORD dwNumChunks; ///< The number of chunks in the shader object. 72 | } D3D10_ShaderObjectHeader; 73 | 74 | DWORD dwChunkTable[D3D10_ShaderObjectHeader.dwNumChunks]; 75 | 76 | local int i; 77 | local int chpos; 78 | for(i=0;i; ///< A FourCC value identifying the chunk type. 84 | DWORD dwChunkDataSize; ///< The size of the chunk-data i.e. the size not including the size of the chunk header. 85 | } D3D10_ChunkHeader; 86 | chpos = FTell(); 87 | if(D3D10_ChunkHeader.dwChunkType == RDEF){ 88 | SetBackColor(cPurple); 89 | /// The header for "RDEF" Resource DEFinition chunks. 90 | struct 91 | { 92 | local uint chunkIdx = i; 93 | local uint pos = FTell(); 94 | DWORD dwConstantBuffers; ///< The number of constant-buffers. 95 | DWORD dwConstBufferOffset; ///< The offset from the start of the RDEF chunk data to the first D3D10_ConstantBuffer structure. 96 | DWORD dwBoundResources; ///< The number of bound resources. 97 | DWORD dwBoundResourceOffset; ///< The offset from the start of the RDEF chunk data to the first D3D10_ResourceBinding structure. 98 | DWORD dwVersion; ///< The version of the shader where the hiword = the shader type & the loword = the shader model. 99 | DWORD dwCompilerFlags; ///< The flags passed to the D3D10 HLSL compiler. 100 | DWORD dwCreatorOffset; ///< The offset from the start of the RDEF chunk data to the Creator string. 101 | DWORD dwMagic; ///< Magic Number - 'R', 'D', '1', '1'. 102 | DWORD dwReserved[7]; ///< Unknown. 103 | } D3D11_RDEF_Header; 104 | local int j; 105 | local int j2; 106 | local int rpos; 107 | local int tpos; 108 | local int ttpos; 109 | local int tttpos; 110 | FSeek(D3D11_RDEF_Header.pos+D3D11_RDEF_Header.dwConstBufferOffset); 111 | for(j=0;j; ///< The offset from the start of the RDEF chunk data to the constant-buffer name string. 116 | local string strName = readString(dwNameOffset); 117 | DWORD dwVariables; ///< The number of constants in the constant-buffer. 118 | DWORD dwOffset; ///< The offset from the start of the RDEF chunk data to the first const in this buffer. 119 | DWORD dwSize; ///< The size of the constant-buffer. 120 | DWORD dwType; ///< The type of the constant-buffer. 121 | DWORD dwFlags; ///< Flags. See D3D10_SHADER_CBUFFER_FLAGS. 122 | rpos = FTell(); 123 | FSeek(D3D11_RDEF_Header.pos+D3D10_ConstantBuffer.dwOffset); 124 | /// A per constant structure in the RDEF chunk. 125 | struct Constant 126 | { 127 | DWORD dwNameOffset; ///< The offset from the start of the RDEF chunk data to the constant name string. 128 | local string strName = readString(dwNameOffset); 129 | DWORD dwStartOffset; ///< The offset of the constant within the constant-buffer. 130 | DWORD dwSize; ///< The size of the constant. 131 | DWORD dwFlags; ///< Shader-variable flags, see D3D10_SHADER_VARIABLE_FLAGS. 132 | DWORD dwTypeOffset; ///< The offset from the start of the RDEF chunk data to the D3D10_Type for this constant. 133 | DWORD dwDefaultValue; ///< The default value of the constant. 134 | DWORD dwReserved[4]; ///< Unknown. 135 | tpos = FTell(); 136 | FSeek(D3D11_RDEF_Header.pos+dwTypeOffset); 137 | /// A structure defining the type of variables. Used in the RDEF chunk to define the type of constants. 138 | struct Type 139 | { 140 | local uint pos = FTell(); 141 | WORD wClass; ///< The variable class of the type. See D3D10_SHADER_VARIABLE_CLASS. 142 | WORD wType; ///< The variable type. See D3D10_SHADER_VARIABLE_TYPE. 143 | WORD wRows; ///< Number of rows in a matrix. 1 for other numeric types, 0 for other types. 144 | WORD wColumns; ///< Number of columns in a matrix. 1 for other numeric types, 0 for other types. 145 | WORD wElements; ///< Number of elements in an array; otherwise 0. 146 | WORD wMembers; ///< Number of members in the structure; otherwise 0. 147 | WORD wOffset; ///< Offset to something. Seems always to be 0. 148 | WORD wReserved; ///< Unknown. Seems always to be 0. 149 | DWORD dwReserved[4]; ///< Unknown. 150 | DWORD dwNameOffset; ///< The offset from the start of the RDEF chunk data to the constant name string. 151 | local string strName = readString(dwNameOffset); 152 | if((wOffset != 0)&&(wMembers>0)){ 153 | ttpos = FTell(); 154 | FSeek(D3D11_RDEF_Header.pos+wOffset); 155 | struct SubConstant{ 156 | DWORD dwNameOffset; 157 | DWORD dwTypeOffset; 158 | DWORD unkn; 159 | tttpos = FTell(); 160 | FSeek(D3D11_RDEF_Header.pos+dwTypeOffset); 161 | Type type; 162 | FSeek(tttpos); 163 | } subConstants[wMembers]; 164 | FSeek(ttpos); 165 | } 166 | } D3D10_Type; 167 | FSeek(tpos); 168 | } D3D11_Constant[D3D10_ConstantBuffer.dwVariables]; 169 | FSeek(rpos); 170 | } D3D10_ConstantBuffer; 171 | 172 | } 173 | FSeek(D3D11_RDEF_Header.pos+D3D11_RDEF_Header.dwBoundResourceOffset); 174 | for(j=0;j; ///< The offset from the start of the RDEF chunk data to the resource name string. 179 | DWORD dwType; ///< The type of data in the resource. 180 | DWORD ReturnType; ///< For textures the return type otherwise 0. 181 | DWORD Dimension; ///< The number of dimensions of the data in the resource. 182 | DWORD dwNumSamples; ///< For multisampled textures the multisampled otherwise 0 183 | DWORD dwBindPoint; ///< The starting bind-point. 184 | DWORD dwBindCount; ///< The number of bind-points for arrays(contiguous). 185 | DWORD dwFlags; ///< Flags. See D3D10_SHADER_INPUT_FLAGS. 186 | } D3D10_ResourceBinding; 187 | } 188 | } 189 | FSeek(chpos+D3D10_ChunkHeader.dwChunkDataSize); 190 | continue; 191 | /* 192 | /// The header for "RDEF" Resource DEFinition chunks. 193 | struct 194 | { 195 | local uint pos = FTell(); 196 | DWORD dwConstantBuffers; ///< The number of constant-buffers. 197 | DWORD dwConstBufferOffset; ///< The offset from the start of the RDEF chunk data to the first D3D10_ConstantBuffer structure. 198 | DWORD dwBoundResources; ///< The number of bound resources. 199 | DWORD dwBoundResourceOffset; ///< The offset from the start of the RDEF chunk data to the first D3D10_ResourceBinding structure. 200 | DWORD dwVersion; ///< The version of the shader where the hiword = the shader type & the loword = the shader model. 201 | DWORD dwCompilerFlags; ///< The flags passed to the D3D10 HLSL compiler. 202 | DWORD dwCreatorOffset; ///< The offset from the start of the RDEF chunk data to the Creator string. 203 | } D3D10_RDEF_Header; 204 | */ 205 | 206 | 207 | 208 | 209 | /* 210 | /// A per constant structure in the RDEF chunk. 211 | struct Constant 212 | { 213 | DWORD dwNameOffset; ///< The offset from the start of the RDEF chunk data to the constant name string. 214 | DWORD dwStartOffset; ///< The offset of the constant within the constant-buffer. 215 | DWORD dwSize; ///< The size of the constant. 216 | DWORD dwFlags; ///< Shader-variable flags, see D3D10_SHADER_VARIABLE_FLAGS. 217 | DWORD dwTypeOffset; ///< The offset from the start of the RDEF chunk data to the D3D10_Type for this constant. 218 | DWORD dwDefaultValue; ///< The default value of the constant. 219 | } D3D10_Constant; 220 | */ 221 | 222 | /// A per constant structure in the RDEF chunk. 223 | /*typedef struct 224 | { 225 | DWORD dwNameOffset; ///< The offset from the start of the RDEF chunk data to the constant name string. 226 | DWORD dwStartOffset; ///< The offset of the constant within the constant-buffer. 227 | DWORD dwSize; ///< The size of the constant. 228 | DWORD dwFlags; ///< Shader-variable flags, see D3D10_SHADER_VARIABLE_FLAGS. 229 | DWORD dwTypeOffset; ///< The offset from the start of the RDEF chunk data to the D3D10_Type for this constant. 230 | DWORD dwDefaultValue; ///< The default value of the constant. 231 | DWORD dwReserved[4]; ///< Unknown. 232 | } D3D11_Constant;*/ 233 | 234 | 235 | 236 | /// The header for "ISGN" Input SiGNature & "OSGN" Output SiGNature chunks. 237 | struct 238 | { 239 | DWORD dwSignatures; ///< The number of signatures. 240 | DWORD dwReserved; ///< Unknown. Seems always to be 8. 241 | } D3D10_xSGN_Header; 242 | 243 | /// A per signature structure in the ISGN & OSGN chunks. 244 | struct 245 | { 246 | DWORD dwSemanticNameOffset; ///< The offset from the start of the chunk data to the semantic name string. 247 | DWORD dwSemanticIndex; ///< The semantic index. Used to differentiate different signatures that use the same semantic. 248 | DWORD dwSystemValueType; ///< The type of the system value. See D3D10_NAME. 249 | DWORD dwComponentType; ///< The per-component type of the data. See D3D10_REGISTER_COMPONENT_TYPE. 250 | DWORD dwRegister; ///< The register used for the data. 251 | WORD wMask; ///< A mask indicating which components of a register are used. 252 | WORD wPadding; ///< Padding the structure to DWORD divisible width. 253 | } D3D10_Signature; 254 | 255 | /// The header for "SHDR" SHaDeR chunks. 256 | struct 257 | { 258 | DWORD dwVersion; ///< The shader model of the shader. 259 | DWORD dwTokenCount; ///< The number of DWORD tokens in the shader. 260 | } D3D10_SHDR_Header; 261 | 262 | /// A structure defining the data held in the STAT chunk. 263 | struct 264 | { 265 | UINT InstructionCount; ///< The number of emitted instructions. 266 | UINT TempRegisterCount; ///< The number of temporary registers used. 267 | UINT DefCount; ///< The number of constant definitions. 268 | UINT DclCount; ///< The number of declarations (input + output). 269 | UINT FloatInstructionCount; ///< The number of floating point arithmetic instructions used. 270 | UINT IntInstructionCount; ///< The number of signed integer arithmetic instructions used. 271 | UINT UintInstructionCount; ///< The number of unsigned integer arithmetic instructions used. 272 | UINT StaticFlowControlCount; ///< The number of static flow control instructions used. 273 | UINT DynamicFlowControlCount; ///< The number of dynamic flow control instructions used. 274 | UINT MacroInstructionCount; ///< The number of macro instructions used. 275 | UINT TempArrayCount; ///< The number of temporary arrays used. 276 | UINT ArrayInstructionCount; ///< The number of array instructions used. 277 | UINT CutInstructionCount; ///< The number of cut instructions used. 278 | UINT EmitInstructionCount; ///< The number of emit instructions used. 279 | UINT TextureNormalInstructions; ///< The number of non-categorized texture instructions. 280 | UINT TextureLoadInstructions; ///< The number of texture load instructions. 281 | UINT TextureCompInstructions; ///< The number of texture comparison instructions. 282 | UINT TextureBiasInstructions; ///< The number of texture bias instructions. 283 | UINT TextureGradientInstructions; ///< The number of texture gradient instructions. 284 | UINT Reserved[10]; ///< Unknown stats. 285 | } D3D10_SHADER_STATS; 286 | } 287 | 288 | /* 289 | /// A structure describing an indexable temp register. 290 | typedef struct 291 | { 292 | DWORD dwIndex; ///< The index of the register ie. x0, x1, etc. 293 | DWORD dwSize; ///< The number of indexable elements within the array. 294 | DWORD dwComponentCount; ///< The number of components in each array element. 295 | } D3D10_IndexableTempRegister; 296 | 297 | /// A structure describing an global memory register. 298 | typedef struct 299 | { 300 | DWORD dwRegister; ///< The operand coding of the register. 301 | DWORD dwIndex; ///< The index of the register ie. g0, g1, etc. 302 | DWORD dwStride; ///< The struct byte stride, 0 for raw memories. 303 | DWORD dwCount; ///< The count of elements in the memory. 304 | } D3D10_GlobalMemoryRegister; 305 | */ -------------------------------------------------------------------------------- /010 Scripts/CopyConstantBuffer.1sc: -------------------------------------------------------------------------------- 1 | //-------------------------------------- 2 | //--- 010 Editor v6.0.1 Script File 3 | // 4 | // File: 5 | // Author: 6 | // Revision: 7 | // Purpose: 8 | //-------------------------------------- 9 | 10 | void AIH(DWORD& val,DWORD off, DWORD pos, DWORD size); 11 | uint fidx[2]; 12 | uint cnt; 13 | uint i; 14 | char fif[]; 15 | //#define AIH(A,B,C,D) A = adjustBySizeIfHigher(A,B,C,D); 16 | //#define AIH adjustBySizeIfHigher 17 | 18 | 19 | //adjustBySizeIfHigher 20 | void AIH(DWORD& val,DWORD off, DWORD pos, DWORD size){ 21 | if(val+off>=pos){ 22 | Printf("Change %08x to %08x [%08x >= %08x]\n",val,val+size,val+off,pos); 23 | val = val + size; 24 | }else{ 25 | Printf("Not changing %08x [%08x < %08x]\n",val,val+off,pos); 26 | } 27 | } 28 | //adjustBySizeIfHigher 29 | void AIHW(WORD& val,DWORD off, DWORD pos, DWORD size){ 30 | if(val+off>=pos){ 31 | Printf("Change %08x to %08x [%08x >= %08x]\n",val,val+size,val+off,pos); 32 | val = val + size; 33 | }else{ 34 | Printf("Not changing %08x [%08x < %08x]\n",val,val+off,pos); 35 | } 36 | } 37 | 38 | 39 | 40 | for(i=0;iD3D10_ShaderObjectHeader.dwNumChunks){ 154 | Warning("chunkIdx > dwNumChunks, %d > %d",idx,D3D10_ShaderObjectHeader.dwNumChunks); 155 | } 156 | size += Strlen(D3D11_Constant_D3D10_Type_strName)+Strlen(D3D11_Constant_strName)+Strlen(strName); 157 | Printf("chunkIdx: %d\n", idx); 158 | Printf("%s\n", strName); 159 | Printf("%s\n", D3D11_Constant_strName); 160 | Printf("%s\n", D3D11_Constant_D3D10_Type_strName); 161 | local uint pos = D3D11_RDEF_Header.pos+D3D10_ChunkHeader[idx].dwChunkDataSize; 162 | 163 | local DWORD SZB = sizeof(D3D10_ConstantBuffer[0]); 164 | local DWORD SZBI = sizeof(D3D10_ResourceBinding[0]); 165 | local uint pos2 = D3D11_RDEF_Header.pos+D3D11_RDEF_Header.dwConstBufferOffset+D3D11_RDEF_Header.dwConstantBuffers*SZB; 166 | local uint pos3 = D3D11_RDEF_Header.pos+D3D11_RDEF_Header.dwBoundResourceOffset+D3D11_RDEF_Header.dwBoundResources*SZBI; 167 | 168 | Printf("pos: %08x pos2: %08x size: %d\n",pos,pos2,size); 169 | 170 | local uint handledTypeOffsets[1000]; 171 | local uint hTOO = 0; 172 | local uint found = 0; 173 | local uint n; 174 | local uint x2; 175 | local WORD wMembers; 176 | for(i=0;i; 32 | local int starts[MAX_HASH_LENGTH]; 33 | local int lengths[MAX_HASH_LENGTH]; 34 | local int idx1 = 1000; 35 | local int Hidx = 0; 36 | local char possibleStringsTmp[] = possibleStrings; 37 | local char name[]; 38 | local int crcTestLen; 39 | local uint64 jamcrc; 40 | starts[0] = 0; 41 | while(idx1>0){ 42 | idx1 = Strchr(possibleStringsTmp,','); 43 | //local int idx2 = Strchr(StrDel(possibleStrings,0,idx1+1),','); 44 | //local int crcTestLen = ChecksumAlgArrayBytes(CHECKSUM_CRC32,result,"CB_BGTexture",12,"",0x04C11DB7,-1); 45 | name = StrDel(possibleStringsTmp,idx1,Strlen(possibleStringsTmp)); 46 | lengths[Hidx] = Strlen(name); 47 | hashes[Hidx] = createJamcrc(name); 48 | starts[Hidx+1] = starts[Hidx]+idx1+1; 49 | possibleStringsTmp = StrDel(possibleStringsTmp,0,idx1+1); 50 | Hidx++; 51 | /*if(Hidx==2){ 52 | break; 53 | }*/ 54 | } 55 | MAX_HASH_LENGTH = Hidx; 56 | 57 | struct ResBind; 58 | struct ResBind{ 59 | ubyte type; 60 | ubyte unkn1; 61 | ubyte unkn2; 62 | ubyte unkn3; 63 | uint32 x; 64 | //not so shure if this is correct 65 | uint texIdx; 66 | uint unkn5; 67 | }; 68 | 69 | 70 | struct Header{ 71 | long id; 72 | byte unkn1[0x0C]; 73 | uint materialCount; 74 | uint textureCount; 75 | uint64 textureOffset; 76 | uint64 materialOffset; 77 | }; 78 | struct Texture{ 79 | // fileTypeCode for tex is [(zlib.crc32("rTexture".encode()) ^ 0xffffffff) & 0x7fffffff] 80 | uint fileTypeCode; 81 | byte unkn2[12]; 82 | char path[256]; 83 | }; 84 | struct Material{ 85 | uint headId; 86 | //for example (zlib.crc32("NPC_Mt__4".encode()) ^ 0xffffffff) & 0x7fffffff 87 | uint materialNameHash; 88 | uint shaderHash; 89 | uint skinid; 90 | uint matSize; 91 | short unkn4; 92 | ubyte floatArrOff; 93 | ubyte unkn5[9]; 94 | ubyte unkn6; 95 | ubyte unkn7[15]; 96 | uint startAddr; 97 | uint unkn8; 98 | }; 99 | 100 | string ReadMaterial(Material& v){ 101 | string s; 102 | string s2=""; 103 | if(v.headId==0x4516E7AB){ 104 | s2 = "nDraw::Material"; 105 | } 106 | SPrintf( s, "%s skinid:%08x shaderHash:%08x",s2,v.skinid,v.shaderHash); 107 | return s; 108 | } 109 | 110 | 111 | 112 | 113 | #include "mhw_structures_generated.bt" 114 | 115 | struct MaterialA(int count){ 116 | Material material[count]; 117 | }; 118 | struct ResBindA(int count){ 119 | ResBind resBind[count]; 120 | }; 121 | string ReadTexture(Texture& t){ 122 | return t.path; 123 | } 124 | string ReadHeader(Header& h){ 125 | return "rMaterial"; 126 | } 127 | 128 | 129 | Header head; 130 | Texture textures[head.textureCount]; 131 | 132 | 133 | string translate(uint32 partialHash){ 134 | string s = ""; 135 | for(i=0;i> 12; 150 | if(v.texIdx-1; 178 | for(i=0;i; 182 | left = (material.material[i].matSize-material.material[i].floatArrOff*8)/4; 183 | for(j=0;j> 12); 187 | sz = FTell()-oldpos; 188 | left -= sz/4; 189 | if(FTell() % 16>0){ 190 | left -= 16-FTell() % 16; 191 | FSeek(FTell()+(16-FTell() % 16)); 192 | } 193 | } 194 | } 195 | if(left>0){ 196 | struct FloatArr{ 197 | float floatVal[left]; 198 | }floatArr; 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /fetch_shader_classes/ListBindingNames.ryo: -------------------------------------------------------------------------------- 1 | SSShadow,tShadowMap,gHotLightsSRV,gTileLightParamSRV,tileLighting,intervalPoints,intervalPointCount,froxelVolumes,froxelVolumesMulti,indirectCount,rwFroxels,CBViewProjection,CBScreen,CBLightParameters,CBVRCommon,CBVRCompute,SSVRLinear,tLuminance,tTransmittance,rwLuminance,rwTransmittance,CBVRFilter,SSGeneric__disclosure,SSVertexPosition__disclosure,gJointMatrixBuffer,gUpdateBuffer,tRMTMap__disclosure,tVertexNormalMap__disclosure,tVertexPositionMap__disclosure,CBModel,CBROPTest,CBUpdateBufferFromMeshData,CBMhMaterialOZK001Local__disclosure,CBMhMaterialEM032Local__disclosure,tBroadAreaShadowMap,CBLight,gInstanceBuffer,gInstanceIndexBuffer,CBInstancing,SSFilter,tDepthMap,ManualCoCSrc,CoCAlphaDst,MaskUAV,CBBokehCOCSettings,lightProbesR,lightProbesRGB,lightProbesDest,tLightProbesShadowMap,lightProbesTocCollision,lightProbesTetraVertices,lightProbesNeighborIndices,lightProbesVertices,tGBufferDepthMap,tGBuffer2,CBLightProbes,CBLGTPRBDebug,SSPrimAlbedo,tPrimAlbedoMap,CBPrimSystem,CBPrimitive,gInstanceBufferPF,tVertexTangentMap__disclosure,CBMhMaterialVfxFloodLocal__disclosure,SSVolumeBlendDepth,SSAlbedo__disclosure,SSNormal__disclosure,SSEmissive__disclosure,SSCube__disclosure,SSFlow__disclosure,SSOpacity__disclosure,tVolumeBlendDepthMap,gInstanceBufferMaterial,tAlbedoMap__disclosure,tNormalMap__disclosure,tEmissiveMap__disclosure,tCubeMap__disclosure,tFlowMap__disclosure,tSceneEnvMap,tOpacityMap__disclosure,tAlbedoBlendMap__disclosure,CBMaterialCommon__disclosure,SSRefraction,SSProjectionLight,SSFogLinear,SSFogWrapLinear,tRefractionMap,tSpotProjection,tPrimaryProjection,tFogVolumeMap,tFogTable,tMipFogMain,tMipFogTarget,tMipFogTable,CBFog,gJointMatrixBufferPF,tWaterReflectionDepth,CBRenderFrame,CBTestLight,gPickCount,gPickData,CBPick,SSColorMask__disclosure,SSAlbedoBlend__disclosure,SSAddNormal__disclosure,SSAddNormalMask__disclosure,SSPaint__disclosure,SSPanoramaMap__disclosure,tColorMaskMap__disclosure,tFxMap__disclosure,tAddNormalMap__disclosure,tAddNormalMaskMap__disclosure,tPaintKzMap__disclosure,tPaintPbMap__disclosure,tPanoramaMap__disclosure,tPartsMaskMap__disclosure,tSnowMap__disclosure,CBMhMaterialEMGlobal,tBaseMap,tGBuffer4,tGBuffer5,tNeighborMax,CBMotionBlurReconstruction,SSVRWrapPoint,rayVolumes,tileMultiList,tVolumeTex0,tVolumeTex1,tVolumeTex2,tVolumeTex3,rwIntervalPoints,rwFroxelVolumes,rwFroxelVolumesMulti,CBVRVolumeParams,tPrimaryShadow,tSSShadowBlurMap,CBGaussian,CBMhSky2SimplePS,tColorTargetUAV,CBSystemColor,RwTileMaxH,CBNewDOFFilter,inputBufferSH3R,tOutputCubeIRM,SSBase,CBAmbientOcclusion,tileSingleList,SSCubeToIRM,tIRMInputCube,ouputBufferSH3_TRGB,SSLinear,SSPoint,tBlendMap,tGBuffer1,tPrevGBufferID,rwOutput,CB_TemporalAA2,pix_clear_constants,SSSHDiffuse,SSWaterCustom,SSWaterCustomWrap,tVfxNormalBlend,tSHDiffuse,tWaterCustomAlbedoMap,tWaterCustomNormalMap,tWaterCustomEmissiveMap,tWaterCustomRMTMap,tWaterCustomDetailNormalMap,tWaterCustomProjectionNormalMap,tWaterCustomFlowMap,tWaterCustomAlphaMap,tWaterCustomCubeMap,CBWaterCustomLight,CBWaterMaterial,CBWaterCustom,inputTexture,outputCube,CBCubeCopy,SSSystemSnowHeight,SSSystemSnowHeightPoint,tDitherMap,tSystemSnowHeightMap,tSystemSnowNormalMap,gRWTexture,CBViewFrustum,CBTest,gMeshVertexBuffer,gRWUpdateBuffer,CBUpdateBufferFromMesh,CBUpdateBufferFromMeshConditions2,gLuminanceBufferSRV,CBLuminance,gActiveOcclusionUAV,writeSHDiffuseOut,CBSHDiffuse,tGBuffer0,tGBuffer3,tSSShadowMap,tTiledDeferredOutput,SSDisplacement__disclosure,tDisplacementMap__disclosure,gWavePointBuffer,CBMhMaterialVfxWaveLocal__disclosure,CBMhMaterialVfxWave,SSDetailNormal__disclosure,SSSplash__disclosure,tDetailNormalMap__disclosure,tSplashMap__disclosure,gPlantOnSurfaceIndexBuffer,gPlantOnSurfaceMatrixBuffer,gPlantOnSurfaceMatrixBufferPF,CB_PlantOnSurface,CBMhSkyGBuffer,gOcclusionVoxelInfo,gActiveOcclusionVoxelBufferUAV,gIndirectArgsUAV,CBPrimGpuOcclusionVoxelSystem,SSSystemSnowHeightDS,SSAlbedo,SSRMT,SSEmissive,tHeightMap,tAlbedoMap,tRMTMap,tEmissiveMap,tAlbedoBlendMapR,tRMTBlendMapR,tEmissiveMapR,tSnowFieldVolumeBlendDepthMap,tUnderAlbedoMap,CBSnowFieldMaterial,CBConstantHaltonSequence,CBCapsuleAO,CBCapsuleAOGeomParam,SSRMT__disclosure,CBMhMaterialFlowLavaLocal__disclosure,SSVRPoint,rwHoldoutAlpha,SSCube,SSDepth,tCubeMap,tPrecomputedBRDFMap,tSSLRTraceMap,tSSLR_BlurredMipMap,tDecalMaskMap,tSSLR_EffectRelectionMap,tSSLR_ResolveMapUAV,tSSLR_TemporalMapUAV,CBSSLR,srcFurVelocityBuffer,CBMhMaterialVfxDebufBodyLocal__disclosure,tRWSSAOUAV,tileDepth,rwIndirectCount,rwIntervalPointCount,rwTileUnused_nc__uavcounter,rwRayVolumes,rwTileSingle_nc__uavcounter,rwTileMulti_nc__uavcounter,CBLightShaft,gEmitters,gEmitterRange,gParticleData,gParticleDataIndex,gParticleBinary,gPrimCsOutVertex,gPrimCsOutIndex,SSSky,SSSkyCloud,SSSkySun,SSSkyStarrySky,SSSkyCurve,tSkyBaseMap,tSkySunRegionMap,tSkyCloudRegionMap,tSkyCloudsSideMap,tSkyCloudsTopMap0,tSkyCloudsTopMap1,tSkyBlendBaseMap,tSkyBlendSunRegionMap,tSkyBlendCloudRegionMap,tSkyBlendCloudsSideMap,tSkyBlendCloudsTopMap0,tSkyBlendCloudsTopMap1,tSkySunLightMaskMap,tSkyStarrySkyMap,tSkyCurveMap,CBMhSky2PS,tMaskMap__disclosure,tPrimSceneDepthMap,gPrimVertex,gPrimTemporal,gPrimLightProbes,CBPrimBufferDescription,SSPrimNormal,SSPrimSceneTex,SSPrimSceneTexDownSample,SSPrimCube,tPrimNormalMap,tPrimSceneTex,tPrimSceneTexDownSample,tPrimCubeMap,CBPrimitiveEx,CBPrimitivePick,gSrcVB,gDestVB,gDestNormal,CBComputeSkinning,gTiangleIndex,gActiveOcclusion,gOcclusionCellVertexBuffer,gOcclusionCellIndexBuffer,recomputeMap,tLuminanceRecompute,tTransmittanceRecompute,rwCheckerDepth,rwCheckerLuminance,rwCheckerTransmittance,recomputeList,tHTileTexture,tIRMInputCube2,outputCubeMip1,outputCubeMip2,outputCubeMip3,outputCubeMip4,outputCubeMip5,CBCubeBlend,CBWaterWave,SSSystemSnowHeightDepthTest,SSVertexColor,tSystemSnowHeightDepthMap,gSnowField4GeomInfo,tVertexColorMap,CBSystemSnow,CBSnowField4Geometry,CBWorkaround,SrcTexture,CoCSrc,SSNormal,SSDetailNormal,tNormalMap,tNormalBlendMapR,tBakedNormalMap,tUnderNormalMap,CBSnowField2Material,outputCubeMip6,outputCubeMip7,SSPrimAlphaMask,tPrimAlphaMask,CBMhMaterialVfxDistDispWLocal__disclosure,CBBloom,SSFilterBlend,CBFilter,CBGUIGlobal,SSGUI,tGUIBaseMap,tGUIBlendMap,tGUIAlphaMap,tGUINormalMap,tGUIEmissiveMap,CBGUIGBuffer,TileMax,RwNeighbor,SSSystemCopy,ditherMap,tCheckerDepth,rwFinalL,rwFinalT,rwHoldoutDepth,tileUnused,clearL0,clearL1,clearL2,clearL3,CompressDOFImage,RwImage,CBWaterModel,gUpdateBuffer2,CBMhMaterialEM105Local__disclosure,tDepthMipMapTarget0,tDepthMipMapTarget1,tDepthMipMapTarget2,tDepthMipMapTarget3,tDepthMapOutput,tApproximateDepthMapOutput,CBSystem,SSDetailEmissive__disclosure,tDetailEmissiveMap__disclosure,TargetTextureSrv,TargetTextureUav,tSrcMap,tSrcMap2,rwDstMap,rwDstMap2,CBVRGaussian,IgnoreColorMask,MultColorAlphaSrc,CB_DL,CBSnowField3Geometry,gSourceVertexBuffer,gOutputVertexBuffer,CBShapeMesh,SSClampPoint,CoC,Image,Neighbor,RwCompressDOFImage,RwDOFAImage,tSSAO,gSrcIB,gRedirect,gDestAccum,CBNormalRecalc,gSunPixelCount,CBMhSky2Sun,tAmbientOccluder,CBAmbientOccluder,ditherList,gLightBitArraySRV,rwFroxelDebug,clearT0,clearT1,clearT2,clearT3,rwTileISP_Single_nc__uavcounter,rwTileI_Single_nc__uavcounter,rwTileIS_Single_nc__uavcounter,rwTileIP_Single_nc__uavcounter,rwTileS_Single_nc__uavcounter,rwTileSP_Single_nc__uavcounter,rwTileP_Single_nc__uavcounter,SSFur__disclosure,SSFx__disclosure,SSPattern__disclosure,SSAlbedoBlendMap__disclosure,tFurMap__disclosure,tPatternMap__disclosure,CBMhMaterialEMSLocal__disclosure,CBMhMaterialGlobal,tLUT3DMap0,tLUT3DMap1,tLUT3DMap2,tLUT3DBlendMap,CBLUTBlending,CBVRRecompute,SSFurVelocity__disclosure,tFurVelocityMap__disclosure,CBMhMaterialStdLocal__disclosure,rwIndirectArgs,CoCAlphaSrc,FarResult,CBDOFFilter,CBImagePlane,CBImagePlane2,tFilterTempMap1,tDepthTargetUAV,holdout,froxels,tVolumeMap,CBHazeFilter,rwClearLumTrans0,rwClearLumTrans1,rwClearLumTrans2,rwClearLumTrans3,CBMhMaterialVfxVATDistLocal__disclosure,CBBokehComposite,CBDecal,CBMhMaterialFakeLensLocal__disclosure,CBFilter2,SSWater,SSWaterWrap,tWaterBaseColor,tWaterBaseDepth,tWaterReflectionColor,tWaterNormalA,tWaterNormalB,tWaterAlbedo,tWaterNormal,tWaterRoughness,tWaterCaustics,tWaterWhitecap,CBMhMaterialVfxDispWaveLocal__disclosure,SSRefractionMask__disclosure,tRefractionMaskMap__disclosure,NearResult,SSTranslucency__disclosure,tTranslucencyMap__disclosure,CBMhMaterialFlowDirLocal__disclosure,NearMask,tColorTarget,tMipMapColorTarget0,tMipMapColorTarget1,tMipMapColorTarget2,tMipMapColorTarget3,CBCreateMipmap,RwTileMax,ComponentReSrc,ComponentImSrc,SSShoveler,shovelerTextureArray,PreSnowFieldDepth,CBWater,CBMhMaterialEM103Local__disclosure,tWaterCubeMapA,tWaterCubeMapB,gIndirectTempArgsUAV,CBPrimGpuSystem,tVolumeFinalLuminance,tVolumeFinalTransmittance,CBVR_Debug,tSSSSSMap,snapshotIndirectData,FarMask,gSortBuffer,CBBitonicSort,CBTSAO,CBMhMaterialDynamicSnow__disclosure,SSVertexColor__disclosure,tHeightMap__disclosure,tVertexColorMap__disclosure,gIndirectArgs,gParticleDataIndexUAV,SSP2O,CBGodRaysFilter,ComponentReSrc_Comp0,ComponentImSrc_Comp0,ComponentReSrc_Comp1,ComponentImSrc_Comp1,CBBloomSample,tCSZ,SSAlpha,SSDecalCube,SSDecalFlow,tAlphaMap,tDecalCubeMap,tDecalFlowMap,CBMhDecal,CBMhDecalSM,gHotLights,gTileLightParam,gTileLightCount,gTileLightMaxCount,rwTileDepths,CBDebug,CBMhSky2VS,CBMhMaterialEM100_01Local__disclosure,tAlbedoOverMap__disclosure,singleMultiHeatMap,SSBorderLinear,tOcclusionMap,CBGodRaysConfiguration,CBSSSSS,CBSSSSS_Profile,SSClampLinear,HDRImage,CBNewDOFFilter2,TraceDispatchBufferUAV,CBMaterialDebug,CBAtmosphere,tReductionDepthMap,tFullSSShadow,tUpsampledTexture,SSPrimOcclusionMap,tPrimDepthMap,CBPrimitiveMetaDataOcclusion,CBSparkleParam,tInput,tHistory,tTransparentDensity,tEffectDensity,rwOuput,rwHistory,SSDevelop,CBDevelopFlags,CBMhMaterialEM100Local__disclosure,rwDownsampleDither,rwDither_nc__uavcounter,CBMhMaterialLandscapeLocal__disclosure,tAlbedoBlendMapR__disclosure,tNormalBlendMapR__disclosure,tRMTBlendMapR__disclosure,tEmissiveMapR__disclosure,tAlbedoBlendMapG__disclosure,tNormalBlendMapG__disclosure,tRMTBlendMapG__disclosure,tEmissiveMapG__disclosure,tAlbedoBlendMapB__disclosure,tNormalBlendMapB__disclosure,tRMTBlendMapB__disclosure,tEmissiveMapB__disclosure,gToneMappingHistogramUAV,CBLightShaft_LightParam,CBMhMaterialLandscapeFlowLocal__disclosure,SSVfxNormal__disclosure,tTiledDeferredNumber,CBHermiteCurve,gErrorUnitCount,gErrorUnitData,rwErrorUnitTexture,CBErrorUnit,SSWaterWave,CBSnowFieldBake,srcVelocityBuffer,tHeight,CBHeightToNormal,tCOCMap,tFilteredCOCMap,tColorFilter0,tColorFilter1,CBColorCorrectCube,CBPrimCopyState,DOFAImage,tToneCurveMap,CBColorCorrect,tVoltexMap__disclosure,CBMhMaterialEM115Local__disclosure,rwReset0,rwReset1,gTileLightCountSRV,rwTileISP_Multi_nc__uavcounter,rwTileI_Multi_nc__uavcounter,rwTileIS_Multi_nc__uavcounter,rwTileIP_Multi_nc__uavcounter,rwTileS_Multi_nc__uavcounter,rwTileSP_Multi_nc__uavcounter,rwTileP_Multi_nc__uavcounter,tDOFMap,SSSphere__disclosure,tSphereMap__disclosure,CBMhMaterialFakeEyeLocal__disclosure,SSWaterWaveWrap,tWaterNormal2,tWaterCausticsMap,tWaterNoise,CBWaterWaveMaterial,gStarInfoBuffer,CBStarrySky,gGpuLogUAV,collisionUsage,CBMhMaterialEM109Local__disclosure,CBUpdateBufferFromMeshConditions,CBMhMaterialSZK001Local__disclosure,gBuffer,gDebugHistogram,inputBufferSH3_TRGB,ouputBufferSH3RGB,CBLGTPRBGen,tHoldout,tHoldoutDepth,rwHoldout,rwRecomputeMap,rwRecomputeList_nc__uavcounter,t3DLUTOutput,CBLUTMaking,tPreDepth,tDepthOut,CBSnowPreProcess,gActiveOcclusionVoxelBuffer,gOcclusionCellOffsetBuffer,PSFTextureSrv,CBBloomSettings,CBPrimitiveDebug,CBWaterDebug,CBSnowField2Debug,CBMaterialSnow__disclosure,CBGUIDevelop,SSColorGrading,CBToneMapping,SSBlend,CB_TemporalAA,CBMhMaterialNPCEyeLocal__disclosure,tWaterCubemap0,tWaterCubemap1,SSPrimTurbulence,gEmitterBinary,gEmitterData,gShapeVertexBuffer,gShapeIndexBuffer,gLayoutCacheBuffer,tTurbulenceVolume0,tTurbulenceVolume1,tTurbulenceVolume2,tTurbulenceVolume3,tTurbulenceVolume4,tTurbulenceVolume5,tTurbulenceVolume6,tTurbulenceVolume7,gForceField,gParticleDataUAV,gParticleBinaryUAV,gCollisionSpaceHeadUAV,gCollisionSpaceEndUAV,CBSpeedTreeLocalWind,SSWrapLinear,SSBorderPoint,tFilterTempMap2,CBGodRaysIterator,TileMaxH,gEmitterUsedIndices,gEmitterDataUAV,gEmitterRangeUAV,tCASInput,tCASOutput,CBCAS,CBSnowFieldGeometry,tHTileTextureUAV,CBSnowShoveler,CBSnowFall,SSHeatMap,tHeatMap,tMipMapTarget0,tMipMapTarget1,tMipMapTarget2,tMipMapTarget3,tMipMapOutput,CBMhMaterialEM002Local__disclosure,gParticleUnusedIndicesUAV,tGlobalCubeOnly,gPrimCsTemporal,CBMhMaterialNPCHairLocal__disclosure,tSkyTempSunAlphaMap,FarAlphaSrc,targetDepthValue,CBBokehAutoFocus,CBTexturePosScaleFactor,fastCopySource,fastCopyTarget,CBMhMaterialSimpleLocal__disclosure,SSSkin__disclosure,tSkinMap__disclosure,CBMhMaterialPLSkinLocal__disclosure,tPickHeightMap,gSnowHeightPickData,CBSnowHeightPick,srcVelocityGBuffer,srcFurVelocityGBuffer,gSrcAccum,CBNormalMerge,rwPrevGBufferID,tColorOutput,SSMaterialBlend__disclosure,tNormalBlendMap__disclosure,tDetailNormalBlendMap__disclosure,tEmissiveBlendMap__disclosure,tMaterialBlendMap__disclosure,tRMTBlendMap__disclosure,CBMhMaterialStdBlendNoFurLocal__disclosure,CBDecalCommon,tGUIFadeMap,CBGUINoiseAndFade,CBMhMaterialEM063Local__disclosure,rwClearRecomputeMap0,CBMhSkyVS,SSSkyBase,tSkySunMap,tSkySunAlphaMap,tSkyCloudMap0,tSkyCloudMap1,tSkyCloudMap2,tSkyCloudMap3,tSkyBlendCloudMap0,tSkyBlendCloudMap1,tSkyBlendCloudMap2,tSkyBlendCloudMap3,CBMhSkyLpPS,SSSnowFieldPreDepth,tSnowField0,tSnowField1,tSnowField2,tSnowField3,tSnowField4,tSnowField5,tSnowField6,tSnowField7,tSnowField8,tSnowField9,tSnowField10,tSnowField11,tSnowField12,tSnowField13,tSnowField14,tSnowField15,tRWPreDepth,CBSnowFieldPreDepth,gSpeedTreeVertexBuffer,CBSpeedTreeCollision__disclosure,CBSpeedTreePrimitiveInfo,CBSpeedTreeSystem,CBMhMaterialSpeedTreeStdBlendLocal__disclosure,CBSpeedTree,CBSpeedTreeGlobalWind,CBSpeedTreeGlobalWindPF,gSpeedTreeLocalWindIndexBuffer,gSpeedTreeLocalWindIndexBufferPF,CBSpeedTreeLocalWindPF,SSAtmosphereDepth,tAtmosphereOpticalDepthMap,tAerosolOpticalDepthMap,tPrecomputedRayleighOutput,tPrecomputedMieOutput,CBGlobalIllumination,CBMhMaterialEM024Local__disclosure,tTileMax,CBMhMaterialVfxWaterLocal__disclosure,froxelDebug,gImpactIvyFloorPointBuffer,gImpactIvyFloorPointBufferPF,CBMhMaterialIvyFloorLocal__disclosure,CBMhMaterialIvyFloor,CBGUIDistanceField,CBMhMaterialEC021Local__disclosure,gOcclusionCellBuffer,CBMhMaterialSpeedTreeStdFurLocal__disclosure,gBab,CBCSClear,tGUINoiseMap,tGUIEdgeMap,CBGUIIcon,CBMhMaterialSlantFloorLocal__disclosure,CBMhMaterialSlantFloor,CBMhSky2GBuffer,CBLuminanceDebugDisp,t2DLUTOutput,tOutlineObjectMap,tOutlineObjectDepthMap,CBOutline,gVoxelMeshIndex,CBMhMaterialEM125Local__disclosure,CB_BGTexture,CBMhMaterialFakeInnerEmitLocal__disclosure,CBBlink,CBMhMaterialEM011Local__disclosure,inputBuffer,SSSkySunBloom,tSkySunMaskMap,rwSunPixelCount,ouputBufferSH3_TR,CBMhMaterialNPCFaceLocal__disclosure,gSpeedTreeBoundingBuffer,gSpeedTreeCsLocalWindIndexBuffer,gBufferHBT,gRWBufferHBT,CBMotionBlur,CBMhMaterialVfxTornadoLocal__disclosure,SSFaceMap__disclosure,tContactShadowDepthMap,tFaceNormalMap__disclosure,tFacePaintMap__disclosure,tFaceMayuMap__disclosure,CBContactShadowInfo,CBMhMaterialNPCEditFaceLocal__disclosure,gColorPickTexture,rwColorPick,CBDevelopColorPick,CBMhMaterialVfxSandFallLocal__disclosure,tOpacityBlendMap__disclosure,SSSnowMaterialBlend__disclosure,tSnowAlbedoMap__disclosure,tSnowNormalBlendMap__disclosure,tSnowDetailNormalBlendMap__disclosure,tSnowEmissiveBlendMap__disclosure,tSnowMaterialBlendMap__disclosure,tSnowRMTBlendMap__disclosure,CBMhMaterialSpeedTreeStdBlendSnowLocal__disclosure,tHistoryMap,tBaseAoMap,tAoOutput,CBMhMaterialPLEditFaceLocal__disclosure,CBWaterPick,CBMhMaterialEM044Local__disclosure,tTexture,tRWTexture1,tRWTexture2,tRWTexture3,tRWTexture4,CBMhMaterialPLHairLocal__disclosure,CBMhMaterialArrayLocal__disclosure,SSArrayMap__disclosure,tArrayMap__disclosure,CBVignetting,tTSAODepthMapOutput,tTSAODepthMipMapTarget0,tTSAODepthMipMapTarget1,tTSAODepthMipMapTarget2,tTSAODepthMipMapTarget3,FarAlphaDst,MultColorAlphaDst,tDstBaseMap,CBMhEmissiveFog__disclosure,SSAlpha__disclosure,tAlphaMap__disclosure,CBMhMaterialSpeedTreeStdLocal__disclosure,CBMhMaterialNPCSkinLocal__disclosure,tColorSrc,tColorDst,CBMhMaterialScrWaterLocal__disclosure,CBMhMaterialEM106Local__disclosure,SSDetail__disclosure,tDetailMapA__disclosure,tDetailMapB__disclosure,tDetailMapC__disclosure,tDetailMapD__disclosure,CBMhSky2SimpleVS,CBPartialColor,CBToneMappingSdrSim,inputCount,CB_CombinedFilter_ImagePlane,tColorFilterTable,tTemporalMap,tCombinedTemporalMap,CB_CombinedFilter,CB_CombinedFilter_ColorCorrect,inputCubeTemp,tFullDepthMap,cbHBAO,CBMhMaterialFlagWaveBlendLocal__disclosure,CBMhMaterial_EM105_EVCLocal__disclosure,cbHDAO,CBMhMaterialScrIceBlendNoFurLocal__disclosure,CBMhMaterialEM117Local__disclosure,tCbr,tRWCbr,rwReset2,gRWRangeCheck,CBMhMaterialSKM001Local__disclosure,CBMhMaterialEM036Local__disclosure,CBConstant,CBMhMaterialTMG001Local__disclosure,CBMhMaterialNikuLocal__disclosure,inputCubeTemp2,outputCubeMip0,CBMhMaterialVfxFakeInnerLocal__disclosure,tDstDepth,CBMhMaterialEM102Local__disclosure,gPrimCsInHeader,gPrimCsInVertex,tTileMaxHorizontal,tRWTileMax,CBMhMaterialPLLocal__disclosure,SSSkyBlend,tSkyMap,tSkyAlphaMap,tSkyBlendMap,tSkyBlendAlphaMap,CBMhSkyPS,gRWStarVertex,CBMhMaterialScrIceBlendLocal__disclosure,SSFurNormal__disclosure,tFurNormalMap__disclosure,tFurMaskMap__disclosure,CBMhSky2SimpleGBuffer,HTileBuffer,CBMhMaterialIridescentBlendLocal__disclosure,CBMhMaterialEM057Local__disclosure,tBaseMaps,CBDepthColor,CBMhMaterialStdBlendLocal__disclosure,CBMhMaterialEM111Local__disclosure,rwSingleMultiHeatMap,rwTargetStats,tFinalLuminance,tFinalTransmittance,tCOCMipMapTarget3,CBMhMaterialUberLocal__disclosure,SSColorDiv__disclosure,CBMhMaterialFurLocal__disclosure,gParticleUnusedIndices,CBMhMaterialVfxDistDispLocal__disclosure,gToneMappingHistogramSRV,gLuminanceBuffer,CBMhMaterialEMLocal__disclosure,RwCoC,CBMhMaterialSpeedTreeStdIceLocal__disclosure,CBMhMaterialNPCLocal__disclosure,CBResample,CBMhMaterialEM124Local__disclosure,SSNormalHeightMap__disclosure,tNormalHeightMap__disclosure,SSAtmosphereScatter,tPrecomputedRayleighSRV,tPrecomputedMieSRV,CBSky,CBMhMaterialTestLocal__disclosure,tFurBlendMap__disclosure,tFurNormalBlendMap__disclosure,CBMhMaterialFurnitureLocal__disclosure,CBMhMaterialBurnLocal__disclosure,SSSnowMap__disclosure,gOriginalVB,gDeformedVB,SeaDisplacement,CBMhMaterialSpeedTreeStdSnowLocal__disclosure,tSSLRTraceMapUAV,SSPrimTubeLightTexture,gTubeLights,tTubeLightTexture0,tTubeLightTexture1,tTubeLightTexture2,tTubeLightTexture3,CBTubeLight,CBMhMaterialFakeRefractionLocal__disclosure,gLightBitArray,tTargetDepth,CBImageEvaluator,CBMhMaterialEM118Local__disclosure,CBMhMaterialEM080Local__disclosure,tDensityMap,tAlbedoUniqueMap__disclosure,tAlbedoExtendMap__disclosure,gChainMotionData,CBModelChain,CBMhMaterialPLEyeLocal__disclosure,tBlurTarget,inputShovelerData,gOutputUAV,CBLayoutCache,WaveParameters,tRWHeightMap,SSSnowHeightNormal,tDepthIn,tNormalOut,SSRadialFilterClampLinear,CBRadialBlurFilter,CBRadialBlurFunction,CBPickObject,CBMhMaterialVfxAuroraLocal__disclosure,tRWNeighborMax,CBMhMaterialVfxIceLocal__disclosure,inputBufferSH3_TR,ouputBufferSH3R,CBMhMaterialFlagWaveLocal__disclosure,texSampler,tLuma,tChroma,CBFXAAParam,CBSystemGamma,inputBufferSH3RGB,CBHermiteCurveRGB,CBMhMaterialScrIceLocal__disclosure,CBMhMaterialBTK001Local__disclosure,SSSnowSystemCopy,tSnowHeightMap,CBMhMaterialFakeSphereLocal__disclosure,CBMhMaterialEM080_01Local__disclosure,CBMhMaterialUberIceLocal__disclosure,gPrimCsInMaterials,tRWTileMaxHorizontal,CBColorCorrectToneCurve -------------------------------------------------------------------------------- /010 Templates/MOD3.bt: -------------------------------------------------------------------------------- 1 | //------------------------------------------------ 2 | //--- 010 Editor v8.0.1 Binary Template 3 | // 4 | // File: 5 | // Authors: CrazyT 6 | // Version: 7 | // Purpose: 8 | // Category: 9 | // File Mask: *.mod3 10 | // ID Bytes: 11 | // History: 12 | //------------------------------------------------ 13 | const float WEIGHT_MULTIPLIER = 1.0/1023; 14 | const float WEIGHT_MULTIPLIER2 = 1.0/255.0; 15 | const float C8S = 0.0078125; 16 | 17 | struct MODVertexBufferIANonSkin1UV; 18 | struct MODVertexBufferIANonSkin2UV; 19 | struct MODVertexBufferIANonSkin3UVColor; 20 | struct MODVertexBufferIANonSkin4UVColor; 21 | struct MODVertexBufferIANonSkin1UVColor; 22 | struct MODVertexBufferIANonSkin2UVColor; 23 | struct MODVertexBufferIASkin4wt1UV; 24 | struct MODVertexBufferIASkin4wt2UV; 25 | struct MODVertexBufferIASkin4wt1UVColor; 26 | struct MODVertexBufferIASkin4wt2UVColor; 27 | struct MODVertexBufferIASkin8wt1UV; 28 | struct MODVertexBufferIASkin8wt2UV; 29 | struct MODVertexBufferIASkin8wt1UVColor; 30 | struct MODVertexBufferIASkin8wt2UVColor; 31 | 32 | struct Bone; 33 | struct LMatrix; 34 | struct AMatrix; 35 | struct Vector3{ 36 | float x; 37 | float y; 38 | float z; 39 | }; 40 | struct Header{ 41 | long id; 42 | ubyte version; 43 | ubyte version2; 44 | short boneCount; 45 | short meshCount; 46 | short materialCount; 47 | long vertexCount; 48 | long faceCount; 49 | long vertexIds; 50 | long vertexBufferSize; 51 | long secondBufferSize; 52 | if(version<190){ 53 | long unknCount; 54 | } 55 | uint64 groupCount; 56 | if((version<190)||(version>220)){ 57 | uint64 boneMapCount; 58 | } 59 | uint64 boneOffset; 60 | uint64 groupOffset; 61 | uint64 materialNamesOffset; 62 | uint64 meshOffset; 63 | uint64 VertexOffset; 64 | if(version<190){ 65 | long vertex2Offset; 66 | } 67 | uint64 FacesOffset; 68 | uint64 unknOffset; 69 | if(version<190){ 70 | long unkOffset2; 71 | Vector3 bbsphereposition; 72 | float bspereradius; 73 | Vector3 bbmin; 74 | long unkn; 75 | Vector3 bbmax; 76 | long unkn; 77 | 78 | } 79 | float unkn1[38]; 80 | byte unkn2[64]; 81 | }; 82 | struct MeshPartV3{ 83 | short unkn; 84 | short VertexCount; 85 | short visibleCondition; //0 is visible at all times; 1 is visible when drawn; 2 is visible when on the back; ... 86 | short materialIdx; 87 | long lod; 88 | short unkn2; 89 | byte blockSize; 90 | byte unkn3; 91 | long VertexSub; 92 | long VertexOffset ; 93 | long blocktype ; 94 | long FaceOffset ; 95 | long FaceCount; 96 | long vertexBase; 97 | ubyte bonremapid; 98 | ubyte unkn7[3]; 99 | ubyte unkn8; 100 | ubyte unkn9[35]; 101 | }; 102 | struct Face{ 103 | short v1; 104 | short v2; 105 | short v3; 106 | }; 107 | 108 | string readMODVertexBufferIANonSkin1UV(MODVertexBufferIANonSkin1UV& v){ 109 | string s; 110 | SPrintf( s ); 111 | return s; 112 | }; 113 | string readMODVertexBufferIANonSkin2UV(MODVertexBufferIANonSkin2UV& v){ 114 | string s; 115 | SPrintf( s ); 116 | return s; 117 | }; 118 | string readMODVertexBufferIANonSkin3UVColor(MODVertexBufferIANonSkin3UVColor& v){ 119 | string s; 120 | SPrintf( s ); 121 | return s; 122 | }; 123 | string readMODVertexBufferIANonSkin4UVColor(MODVertexBufferIANonSkin4UVColor& v){ 124 | string s; 125 | SPrintf( s ); 126 | return s; 127 | }; 128 | string readMODVertexBufferIANonSkin1UVColor(MODVertexBufferIANonSkin1UVColor& v){ 129 | string s; 130 | SPrintf( s ); 131 | return s; 132 | }; 133 | string readMODVertexBufferIANonSkin2UVColor(MODVertexBufferIANonSkin2UVColor& v){ 134 | string s; 135 | SPrintf( s ); 136 | return s; 137 | }; 138 | string readMODVertexBufferIASkin4wt1UV(MODVertexBufferIASkin4wt1UV& v){ 139 | string s; 140 | SPrintf( s ); 141 | return s; 142 | }; 143 | string readMODVertexBufferIASkin4wt2UV(MODVertexBufferIASkin4wt2UV& v){ 144 | string s; 145 | SPrintf( s ); 146 | return s; 147 | }; 148 | string readMODVertexBufferIASkin4wt1UVColor(MODVertexBufferIASkin4wt1UVColor& v){ 149 | string s; 150 | SPrintf( s ); 151 | return s; 152 | }; 153 | string readMODVertexBufferIASkin4wt2UVColor(MODVertexBufferIASkin4wt2UVColor& v){ 154 | string s; 155 | SPrintf( s ); 156 | return s; 157 | }; 158 | string readMODVertexBufferIASkin8wt1UV(MODVertexBufferIASkin8wt1UV& v){ 159 | string s; 160 | SPrintf( s ); 161 | return s; 162 | }; 163 | string readMODVertexBufferIASkin8wt2UV(MODVertexBufferIASkin8wt2UV& v){ 164 | string s; 165 | SPrintf( s ); 166 | return s; 167 | }; 168 | string readMODVertexBufferIASkin8wt1UVColor(MODVertexBufferIASkin8wt1UVColor& v){ 169 | string s; 170 | SPrintf( s ); 171 | return s; 172 | }; 173 | string readMODVertexBufferIASkin8wt2UVColor(MODVertexBufferIASkin8wt2UVColor& v){ 174 | string s; 175 | SPrintf( s ); 176 | return s; 177 | }; 178 | 179 | string readC8S(byte x){ 180 | string s; 181 | SPrintf( s, "%f [raw=%d]",x*C8S,x); 182 | return s; 183 | } 184 | 185 | struct Position{ 186 | float x; 187 | float y; 188 | float z; 189 | }; 190 | 191 | struct Normal{ 192 | byte normalX; 193 | byte normalY; 194 | byte normalZ; 195 | byte normalW; 196 | }; 197 | 198 | struct Tangent{ 199 | byte tangentX; 200 | byte tangentY; 201 | byte tangentZ; 202 | byte tangentW; 203 | }; 204 | 205 | struct Uv{ 206 | hfloat uvX; 207 | hfloat uvY; 208 | }; 209 | 210 | struct BaseWeight{ 211 | long weight; 212 | local float weight1 = (weight & 0x3ff)*WEIGHT_MULTIPLIER; 213 | local float weight2 = ((weight>>10) & 0x3ff)*WEIGHT_MULTIPLIER; 214 | local float weight3 = ((weight>>20) & 0x3ff)*WEIGHT_MULTIPLIER; 215 | local float weight4 = 1-weight3-weight2-weight1; 216 | }; 217 | 218 | struct ExtendedWeight{ 219 | byte weight2_0; 220 | byte weight2_1; 221 | byte weight2_2; 222 | byte weight2_3; 223 | local float weight5 = ((float)weight2_0)*WEIGHT_MULTIPLIER2; 224 | local float weight6 = ((float)weight2_1)*WEIGHT_MULTIPLIER2; 225 | local float weight7 = ((float)weight2_2)*WEIGHT_MULTIPLIER2; 226 | local float weight8 = ((float)weight2_3)*WEIGHT_MULTIPLIER2; 227 | }; 228 | 229 | struct Colour{ 230 | ubyte red; 231 | ubyte green; 232 | ubyte blue; 233 | ubyte alpha; 234 | }; 235 | 236 | struct MODVertexBufferIANonSkin1UV{ 237 | Position position; 238 | Normal normal; 239 | Tangent tangent; 240 | Uv uv; 241 | }; 242 | struct MODVertexBufferIANonSkin2UV{ 243 | Position position; 244 | Normal normal; 245 | Tangent tangent; 246 | Uv uv; 247 | Uv uv2; 248 | }; 249 | struct MODVertexBufferIANonSkin3UVColor{ 250 | Position position; 251 | Normal normal; 252 | Tangent tangent; 253 | Uv uv; 254 | Uv uv2; 255 | Uv uv3; 256 | Colour colour; 257 | }; 258 | struct MODVertexBufferIANonSkin4UVColor{ 259 | Position position; 260 | Normal normal; 261 | Tangent tangent; 262 | Uv uv; 263 | Uv uv2; 264 | Uv uv3; 265 | Uv uv4; 266 | Colour colour; 267 | }; 268 | struct MODVertexBufferIANonSkin1UVColor{ 269 | Position position; 270 | Normal normal; 271 | Tangent tangent; 272 | Uv uv; 273 | Colour colour; 274 | }; 275 | struct MODVertexBufferIANonSkin2UVColor{ 276 | Position position; 277 | Normal normal; 278 | Tangent tangent; 279 | Uv uv; 280 | Uv uv2; 281 | Colour colour; 282 | }; 283 | struct MODVertexBufferIASkin4wt1UV{ 284 | Position position; 285 | Normal normal; 286 | Tangent tangent; 287 | Uv uv; 288 | BaseWeight baseweight; 289 | ubyte bone[4]; 290 | }; 291 | struct MODVertexBufferIASkin4wt2UV{ 292 | Position position; 293 | Normal normal; 294 | Tangent tangent; 295 | Uv uv; 296 | Uv uv2; 297 | BaseWeight baseweight; 298 | ubyte bone[4]; 299 | }; 300 | struct MODVertexBufferIASkin4wt1UVColor{ 301 | Position position; 302 | Normal normal; 303 | Tangent tangent; 304 | Uv uv; 305 | BaseWeight baseweight; 306 | ubyte bone[4]; 307 | Colour colour; 308 | }; 309 | struct MODVertexBufferIASkin4wt2UVColor{ 310 | Position position; 311 | Normal normal; 312 | Tangent tangent; 313 | Uv uv; 314 | Uv uv2; 315 | BaseWeight baseweight; 316 | ubyte bone[4]; 317 | Colour colour; 318 | }; 319 | struct MODVertexBufferIASkin8wt1UV{ 320 | Position position; 321 | Normal normal; 322 | Tangent tangent; 323 | Uv uv; 324 | BaseWeight baseweight; 325 | ExtendedWeight extendedweight; 326 | ubyte bone[8]; 327 | }; 328 | struct MODVertexBufferIASkin8wt2UV{ 329 | Position position; 330 | Normal normal; 331 | Tangent tangent; 332 | Uv uv; 333 | Uv uv2; 334 | BaseWeight baseweight; 335 | ExtendedWeight extendedweight; 336 | ubyte bone[8]; 337 | }; 338 | struct MODVertexBufferIASkin8wt1UVColor{ 339 | Position position; 340 | Normal normal; 341 | Tangent tangent; 342 | Uv uv; 343 | BaseWeight baseweight; 344 | ExtendedWeight extendedweight; 345 | ubyte bone[8]; 346 | Colour colour; 347 | }; 348 | struct MODVertexBufferIASkin8wt2UVColor{ 349 | Position position; 350 | Normal normal; 351 | Tangent tangent; 352 | Uv uv; 353 | Uv uv2; 354 | BaseWeight baseweight; 355 | ExtendedWeight extendedweight; 356 | ubyte bone[8]; 357 | Colour colour; 358 | }; 359 | 360 | struct Faces (int i){ 361 | local int meshPartIdx = i; 362 | Face faces[meshPart[i].FaceCount/3]; 363 | }; 364 | 365 | struct VertexBufferIANonSkin1UV(int i, int hasdata){ 366 | local int meshPartIdx = i; 367 | if(hasdata){ 368 | MODVertexBufferIANonSkin1UV vertexes[meshPart[i].VertexCount]; 369 | } 370 | }; 371 | struct VertexBufferIANonSkin2UV(int i, int hasdata){ 372 | local int meshPartIdx = i; 373 | if(hasdata){ 374 | MODVertexBufferIANonSkin2UV vertexes[meshPart[i].VertexCount]; 375 | } 376 | }; 377 | struct VertexBufferIANonSkin3UVColor(int i, int hasdata){ 378 | local int meshPartIdx = i; 379 | if(hasdata){ 380 | MODVertexBufferIANonSkin3UVColor vertexes[meshPart[i].VertexCount]; 381 | } 382 | }; 383 | struct VertexBufferIANonSkin4UVColor(int i, int hasdata){ 384 | local int meshPartIdx = i; 385 | if(hasdata){ 386 | MODVertexBufferIANonSkin4UVColor vertexes[meshPart[i].VertexCount]; 387 | } 388 | }; 389 | struct VertexBufferIANonSkin1UVColor(int i, int hasdata){ 390 | local int meshPartIdx = i; 391 | if(hasdata){ 392 | MODVertexBufferIANonSkin1UVColor vertexes[meshPart[i].VertexCount]; 393 | } 394 | }; 395 | struct VertexBufferIANonSkin2UVColor(int i, int hasdata){ 396 | local int meshPartIdx = i; 397 | if(hasdata){ 398 | MODVertexBufferIANonSkin2UVColor vertexes[meshPart[i].VertexCount]; 399 | } 400 | }; 401 | struct VertexBufferIASkin4wt1UV(int i, int hasdata){ 402 | local int meshPartIdx = i; 403 | if(hasdata){ 404 | MODVertexBufferIASkin4wt1UV vertexes[meshPart[i].VertexCount]; 405 | } 406 | }; 407 | struct VertexBufferIASkin4wt2UV(int i, int hasdata){ 408 | local int meshPartIdx = i; 409 | if(hasdata){ 410 | MODVertexBufferIASkin4wt2UV vertexes[meshPart[i].VertexCount]; 411 | } 412 | }; 413 | struct VertexBufferIASkin4wt1UVColor(int i, int hasdata){ 414 | local int meshPartIdx = i; 415 | if(hasdata){ 416 | MODVertexBufferIASkin4wt1UVColor vertexes[meshPart[i].VertexCount]; 417 | } 418 | }; 419 | struct VertexBufferIASkin4wt2UVColor(int i, int hasdata){ 420 | local int meshPartIdx = i; 421 | if(hasdata){ 422 | MODVertexBufferIASkin4wt2UVColor vertexes[meshPart[i].VertexCount]; 423 | } 424 | }; 425 | struct VertexBufferIASkin8wt1UV(int i, int hasdata){ 426 | local int meshPartIdx = i; 427 | if(hasdata){ 428 | MODVertexBufferIASkin8wt1UV vertexes[meshPart[i].VertexCount]; 429 | } 430 | }; 431 | struct VertexBufferIASkin8wt2UV(int i, int hasdata){ 432 | local int meshPartIdx = i; 433 | if(hasdata){ 434 | MODVertexBufferIASkin8wt2UV vertexes[meshPart[i].VertexCount]; 435 | } 436 | }; 437 | struct VertexBufferIASkin8wt1UVColor(int i, int hasdata){ 438 | local int meshPartIdx = i; 439 | if(hasdata){ 440 | MODVertexBufferIASkin8wt1UVColor vertexes[meshPart[i].VertexCount]; 441 | } 442 | }; 443 | struct VertexBufferIASkin8wt2UVColor(int i, int hasdata){ 444 | local int meshPartIdx = i; 445 | if(hasdata){ 446 | MODVertexBufferIASkin8wt2UVColor vertexes[meshPart[i].VertexCount]; 447 | } 448 | }; 449 | 450 | 451 | struct Mod3MeshProperties { 452 | uint count; 453 | struct Mod3MeshProperty{ 454 | int boneIndex; 455 | ubyte spacer[12]; 456 | float center[3]; 457 | float radius; 458 | float boxMin[4]; 459 | float boxMax[4]; 460 | float matrix[16]; 461 | float vector[4]; 462 | } mod3MeshProperty[count]; 463 | }; 464 | string readFace(Face &v){ 465 | string s; 466 | SPrintf( s, "%d %d %d", v.v1,v.v2,v.v3 ); 467 | return s; 468 | } 469 | string readMeshPart(MeshPartV3 &v){ 470 | string s; 471 | string mn = ""; 472 | if(v.materialIdx; 503 | 504 | FSeek(head.materialNamesOffset); 505 | struct MaterialName{ 506 | char name[128]; 507 | }materialNames[head.materialCount]; 508 | 509 | FSeek(head.meshOffset); 510 | local int BOFF = 0; 511 | if(head.version==237){ 512 | MeshPartV3 meshPart[head.meshCount]; 513 | Mod3MeshProperties mod3MeshProperties; 514 | //float unknMeshStuff[2556]; //two010 515 | //float unknMeshStuff[216]; //stm730_000_03 516 | local int i=0; 517 | local int unknBlockType = 0; 518 | for(i=0;i0){ 520 | BOFF=meshPart[i].VertexSub+meshPart[i].vertexBase; 521 | FSeek(head.VertexOffset+meshPart[i].VertexOffset+meshPart[i].blockSize*BOFF); 522 | 523 | if(meshPart[i].blocktype==0xa756f2f9){VertexBufferIANonSkin1UV vertexes(i,true);} 524 | if(meshPart[i].blocktype==0xa5104ca0){VertexBufferIANonSkin2UV vertexes(i,true);} 525 | if(meshPart[i].blocktype==0xc3ac03a1){VertexBufferIANonSkin3UVColor vertexes(i,true);} 526 | if(meshPart[i].blocktype==0xc9690ab8){VertexBufferIANonSkin4UVColor vertexes(i,true);} 527 | if(meshPart[i].blocktype==0x818904dc){VertexBufferIANonSkin1UVColor vertexes(i,true);} 528 | if(meshPart[i].blocktype==0xf06033f){VertexBufferIANonSkin2UVColor vertexes(i,true);} 529 | if(meshPart[i].blocktype==0xf637401c){VertexBufferIASkin4wt1UV vertexes(i,true);} 530 | if(meshPart[i].blocktype==0xf471fe45){VertexBufferIASkin4wt2UV vertexes(i,true);} 531 | if(meshPart[i].blocktype==0x3c730760){VertexBufferIASkin4wt1UVColor vertexes(i,true);} 532 | if(meshPart[i].blocktype==0xb2fc0083){VertexBufferIASkin4wt2UVColor vertexes(i,true);} 533 | if(meshPart[i].blocktype==0x81f58067){VertexBufferIASkin8wt1UV vertexes(i,true);} 534 | if(meshPart[i].blocktype==0x83b33e3e){VertexBufferIASkin8wt2UV vertexes(i,true);} 535 | if(meshPart[i].blocktype==0x366995a7){VertexBufferIASkin8wt1UVColor vertexes(i,true);} 536 | if(meshPart[i].blocktype==0xb8e69244){VertexBufferIASkin8wt2UVColor vertexes(i,true);} 537 | } 538 | } 539 | for(i=0;i0){ 541 | FSeek(head.FacesOffset+meshPart[i].FaceOffset*2); 542 | Faces faces(i); 543 | } 544 | } 545 | } 546 | if(head.boneCount>0){ 547 | FSeek(head.boneOffset); 548 | struct Bone{ 549 | short unkn1; 550 | ubyte parentId; 551 | ubyte child; 552 | float unkn2; 553 | float length; 554 | float x; 555 | float y; 556 | float z; 557 | }bone[head.boneCount]; 558 | struct LMatrix{ 559 | struct C{ 560 | float r1; 561 | float r2; 562 | float r3; 563 | float r4; 564 | }c[4]; 565 | }lmatrices[head.boneCount]; 566 | struct AMatrix{ 567 | struct D{ 568 | float r1; 569 | float r2; 570 | float r3; 571 | float r4; 572 | }c[4]; 573 | }amatrices[head.boneCount]; 574 | byte remaptable[512]; 575 | } 576 | FSeek(head.groupOffset); 577 | float unknGroupStuff[head.groupCount*8]; -------------------------------------------------------------------------------- /slimshader/System.Reactive.Interfaces.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.Reactive.Interfaces 5 | 6 | 7 | 8 | 9 | The System.Reactive namespace contains interfaces and classes used throughout the Reactive Extensions library. 10 | 11 | 12 | 13 | 14 | The System.Reactive.Concurrency namespace contains interfaces and classes that provide the scheduler infrastructure used by Reactive Extensions to construct and 15 | process event streams. Schedulers are used to parameterize the concurrency introduced by query operators, provide means to virtualize time, to process historical data, 16 | and to write unit tests for functionality built using Reactive Extensions constructs. 17 | 18 | 19 | 20 | 21 | The System.Reactive.Disposables namespace contains interfaces and classes that provide a compositional set of constructs used to deal with resource and subscription 22 | management in Reactive Extensions. Those types are used extensively within the implementation of Reactive Extensions and are useful when writing custom query operators or 23 | schedulers. 24 | 25 | 26 | 27 | 28 | The System.Reactive.Linq namespace contains interfaces and classes that support expressing queries over observable sequences, using Language Integrated Query (LINQ). 29 | Query operators are made available as extension methods for IObservable<T> and IQbservable<T> defined on the Observable and Qbservable classes, respectively. 30 | 31 | 32 | 33 | 34 | The System.Reactive.Subjects namespace contains interfaces and classes to represent subjects, which are objects implementing both IObservable<T> and IObserver<T>. 35 | Subjects are often used as sources of events, allowing one party to raise events and allowing another party to write queries over the event stream. Because of their ability to 36 | have multiple registered observers, subjects are also used as a facility to provide multicast behavior for event streams in queries. 37 | 38 | 39 | 40 | 41 | Scheduler with support for running periodic tasks. 42 | This type of scheduler can be used to run timers more efficiently instead of using recursive scheduling. 43 | 44 | 45 | 46 | 47 | Schedules a periodic piece of work. 48 | 49 | The type of the state passed to the scheduled action. 50 | Initial state passed to the action upon the first iteration. 51 | Period for running the work periodically. 52 | Action to be executed, potentially updating the state. 53 | The disposable object used to cancel the scheduled recurring action (best effort). 54 | 55 | 56 | 57 | Provider for IStopwatch objects. 58 | 59 | 60 | 61 | 62 | Starts a new stopwatch object. 63 | 64 | New stopwatch object; started at the time of the request. 65 | 66 | 67 | 68 | Represents a work item that has been scheduled. 69 | 70 | Absolute time representation type. 71 | 72 | 73 | 74 | Invokes the work item. 75 | 76 | 77 | 78 | 79 | Gets the absolute time at which the item is due for invocation. 80 | 81 | 82 | 83 | 84 | Represents an object that schedules units of work. 85 | 86 | 87 | 88 | 89 | Schedules an action to be executed. 90 | 91 | The type of the state passed to the scheduled action. 92 | State passed to the action to be executed. 93 | Action to be executed. 94 | The disposable object used to cancel the scheduled action (best effort). 95 | 96 | 97 | 98 | Schedules an action to be executed after dueTime. 99 | 100 | The type of the state passed to the scheduled action. 101 | State passed to the action to be executed. 102 | Action to be executed. 103 | Relative time after which to execute the action. 104 | The disposable object used to cancel the scheduled action (best effort). 105 | 106 | 107 | 108 | Schedules an action to be executed at dueTime. 109 | 110 | The type of the state passed to the scheduled action. 111 | State passed to the action to be executed. 112 | Action to be executed. 113 | Absolute time at which to execute the action. 114 | The disposable object used to cancel the scheduled action (best effort). 115 | 116 | 117 | 118 | Gets the scheduler's notion of current time. 119 | 120 | 121 | 122 | 123 | Scheduler with support for starting long-running tasks. 124 | This type of scheduler can be used to run loops more efficiently instead of using recursive scheduling. 125 | 126 | 127 | 128 | 129 | Schedules a long-running piece of work. 130 | 131 | The type of the state passed to the scheduled action. 132 | State passed to the action to be executed. 133 | Action to be executed. 134 | The disposable object used to cancel the scheduled action (best effort). 135 | 136 | Notes to implementers 137 | The returned disposable object should not prevent the work from starting, but only set the cancellation flag passed to the specified action. 138 | 139 | 140 | 141 | 142 | Abstraction for a stopwatch to compute time relative to a starting point. 143 | 144 | 145 | 146 | 147 | Gets the time elapsed since the stopwatch object was obtained. 148 | 149 | 150 | 151 | 152 | Disposable resource with dipsosal state tracking. 153 | 154 | 155 | 156 | 157 | Gets a value that indicates whether the object is disposed. 158 | 159 | 160 | 161 | 162 | Represents a .NET event invocation consisting of the strongly typed object that raised the event and the data that was generated by the event. 163 | 164 | 165 | The type of the sender that raised the event. 166 | This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 167 | 168 | 169 | The type of the event data generated by the event. 170 | This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 171 | 172 | 173 | 174 | 175 | Gets the sender object that raised the event. 176 | 177 | 178 | 179 | 180 | Gets the event data that was generated by the event. 181 | 182 | 183 | 184 | 185 | Represents a data stream signaling its elements by means of an event. 186 | 187 | The type of the event data generated by the event. 188 | 189 | 190 | 191 | Event signaling the next element in the data stream. 192 | 193 | 194 | 195 | 196 | Represents a data stream signaling its elements by means of an event. 197 | 198 | 199 | The type of the event data generated by the event. 200 | This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 201 | 202 | 203 | 204 | 205 | Event signaling the next element in the data stream. 206 | 207 | 208 | 209 | 210 | Provides a mechanism for receiving push-based notifications and returning a response. 211 | 212 | 213 | The type of the elements received by the observer. 214 | This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 215 | 216 | 217 | The type of the result returned from the observer's notification handlers. 218 | This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 219 | 220 | 221 | 222 | 223 | Notifies the observer of a new element in the sequence. 224 | 225 | The new element in the sequence. 226 | Result returned upon observation of a new element. 227 | 228 | 229 | 230 | Notifies the observer that an exception has occurred. 231 | 232 | The exception that occurred. 233 | Result returned upon observation of an error. 234 | 235 | 236 | 237 | Notifies the observer of the end of the sequence. 238 | 239 | Result returned upon observation of the sequence completion. 240 | 241 | 242 | 243 | Represents an observable sequence of elements that have a common key. 244 | 245 | 246 | The type of the key shared by all elements in the group. 247 | This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 248 | 249 | 250 | The type of the elements in the group. 251 | This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 252 | 253 | 254 | 255 | 256 | Gets the common key. 257 | 258 | 259 | 260 | 261 | Provides functionality to evaluate queries against a specific data source wherein the type of the data is known. 262 | 263 | 264 | The type of the data in the data source. 265 | This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 266 | 267 | 268 | 269 | 270 | Provides functionality to evaluate queries against a specific data source wherein the type of the data is not specified. 271 | 272 | 273 | 274 | 275 | Gets the type of the element(s) that are returned when the expression tree associated with this instance of IQbservable is executed. 276 | 277 | 278 | 279 | 280 | Gets the expression tree that is associated with the instance of IQbservable. 281 | 282 | 283 | 284 | 285 | Gets the query provider that is associated with this data source. 286 | 287 | 288 | 289 | 290 | Defines methods to create and execute queries that are described by an IQbservable object. 291 | 292 | 293 | 294 | 295 | Constructs an IQbservable>TResult< object that can evaluate the query represented by a specified expression tree. 296 | 297 | The type of the elements of the System.Reactive.Linq.IQbservable<T> that is returned. 298 | Expression tree representing the query. 299 | IQbservable object that can evaluate the given query expression. 300 | 301 | 302 | 303 | Represents an observable wrapper that can be connected and disconnected from its underlying observable sequence. 304 | 305 | 306 | The type of the elements in the sequence. 307 | This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 308 | 309 | 310 | 311 | 312 | Connects the observable wrapper to its source. All subscribed observers will receive values from the underlying observable sequence as long as the connection is established. 313 | 314 | Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence. 315 | 316 | 317 | 318 | Represents an object that is both an observable sequence as well as an observer. 319 | 320 | The type of the elements processed by the subject. 321 | 322 | 323 | 324 | Represents an object that is both an observable sequence as well as an observer. 325 | 326 | 327 | The type of the elements received by the subject. 328 | This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 329 | 330 | 331 | The type of the elements produced by the subject. 332 | This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. 333 | 334 | 335 | 336 | 337 | -------------------------------------------------------------------------------- /shaderTest/shader_example.cpp: -------------------------------------------------------------------------------- 1 | // include the basic windows header files and the Direct3D header files 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace DirectX; 15 | 16 | #define M_PI 3.14159265358979323846 17 | // include the Direct3D Library file 18 | #pragma comment (lib, "d3d11.lib") 19 | #pragma comment (lib, "d3dx11.lib") 20 | #pragma comment (lib, "d3dx10.lib") 21 | 22 | // define the screen resolution 23 | #define SCREEN_WIDTH 800 24 | #define SCREEN_HEIGHT 600 25 | #define F3 sizeof(float) * 3 26 | #define F2 sizeof(float) * 2 27 | #define F4 sizeof(float) * 4 28 | #define F 2 29 | 30 | struct CBViewProjection; 31 | struct GInstanceBuffer; 32 | 33 | // global declarations 34 | IDXGISwapChain *swapchain; // the pointer to the swap chain interface 35 | ID3D11Device *dev; // the pointer to our Direct3D device interface 36 | ID3D11DeviceContext *devcon; // the pointer to our Direct3D device context 37 | ID3D11RenderTargetView *backbuffer; // the pointer to our back buffer 38 | ID3D11InputLayout *pLayout; // the pointer to the input layout 39 | ID3D11VertexShader *pVS; // the pointer to the vertex shader 40 | ID3D11PixelShader *pPS; // the pointer to the pixel shader 41 | ID3D11Buffer *pVBuffer; // the pointer to the vertex buffer 42 | ID3D11Buffer *pCBuffer; // the pointer to the cbuffer 43 | CBViewProjection* pvsConstData; 44 | GInstanceBuffer* pgInstanceBuffer; 45 | 46 | #define row_major 47 | typedef XMFLOAT4X4A float4x4; 48 | typedef XMFLOAT3X4A float3x4; 49 | typedef XMFLOAT3X3 float3x3; 50 | typedef XMFLOAT4A float4; 51 | typedef XMFLOAT3A float3; 52 | typedef XMFLOAT2A float2; 53 | typedef uint32_t uint; 54 | struct GInstanceBuffer { 55 | row_major float3x4 wmat; // Offset: 0 56 | row_major float3x3 wmatI; // Offset: 48 57 | float4 color; // Offset: 84 58 | uint matirxIndex; // Offset: 100 59 | uint matirxIndexPF; // Offset: 104 60 | float padding; 61 | }; 62 | struct CBViewProjection 63 | { 64 | 65 | row_major float4x4 fViewProj; // Offset: 0 Size: 64 66 | row_major float4x4 fView; // Offset: 64 Size: 64 [unused] 67 | row_major float4x4 fProj; // Offset: 128 Size: 64 [unused] 68 | row_major float4x4 fViewI; // Offset: 192 Size: 64 [unused] 69 | row_major float4x4 fProjI; // Offset: 256 Size: 64 [unused] 70 | row_major float4x4 fViewProjI; // Offset: 320 Size: 64 [unused] 71 | float3 fCameraPos; // Offset: 384 Size: 12 [unused] 72 | float3 fCameraDir; // Offset: 400 Size: 12 [unused] 73 | float3 fZToLinear; // Offset: 416 Size: 12 [unused] 74 | float fCameraNearClip; // Offset: 428 Size: 4 [unused] 75 | float fCameraFarClip; // Offset: 432 Size: 4 [unused] 76 | float fCameraTargetDist; // Offset: 436 Size: 4 [unused] 77 | float4 fPassThrough; // Offset: 448 Size: 16 [unused] 78 | float3 fLODBasePos; // Offset: 464 Size: 12 [unused] 79 | row_major float4x4 fViewProjPF; // Offset: 480 Size: 64 [unused] 80 | row_major float4x4 fViewProjIPF; // Offset: 544 Size: 64 [unused] 81 | row_major float4x4 fViewPF; // Offset: 608 Size: 64 [unused] 82 | row_major float4x4 fProjPF; // Offset: 672 Size: 64 [unused] 83 | row_major float4x4 fViewProjIViewProjPF;// Offset: 736 Size: 64 [unused] 84 | row_major float4x4 fNoJitterProj; // Offset: 800 Size: 64 [unused] 85 | row_major float4x4 fNoJitterViewProj;// Offset: 864 Size: 64 [unused] 86 | row_major float4x4 fNoJitterViewProjI;// Offset: 928 Size: 64 [unused] 87 | row_major float4x4 fNoJitterViewProjIViewProjPF;// Offset: 992 Size: 64 [unused] 88 | float2 fPassThroughCorrect; // Offset: 1056 Size: 8 [unused] 89 | bool bWideMonitor; // Offset: 1064 Size: 4 [unused] 90 | 91 | }; 92 | 93 | // a struct to define a single vertex 94 | struct VERTEX{ 95 | FLOAT X, Y, Z; 96 | FLOAT NX, NY, NZ; 97 | FLOAT TX, TY, TZ, TW; 98 | FLOAT UX, UY; 99 | FLOAT U2X, U2Y; 100 | D3DXCOLOR Color; 101 | FLOAT PX, PY, PZ; 102 | uint32_t iid; 103 | }; 104 | 105 | // function prototypes 106 | void InitD3D(HWND hWnd); // sets up and initializes Direct3D 107 | void RenderFrame(void); // renders a single frame 108 | void CleanD3D(void); // closes Direct3D and releases memory 109 | void InitGraphics(void); // creates the shape to render 110 | void InitPipeline(void); // loads and prepares the shaders 111 | ID3D10Blob* loadfile(const char* filePath); 112 | 113 | // the WindowProc function prototype 114 | LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 115 | 116 | 117 | // the entry point for any Windows program 118 | int WINAPI WinMain(HINSTANCE hInstance, 119 | HINSTANCE hPrevInstance, 120 | LPSTR lpCmdLine, 121 | int nCmdShow) 122 | { 123 | HWND hWnd; 124 | WNDCLASSEX wc; 125 | 126 | ZeroMemory(&wc, sizeof(WNDCLASSEX)); 127 | 128 | wc.cbSize = sizeof(WNDCLASSEX); 129 | wc.style = CS_HREDRAW | CS_VREDRAW; 130 | wc.lpfnWndProc = WindowProc; 131 | wc.hInstance = hInstance; 132 | wc.hCursor = LoadCursor(NULL, IDC_ARROW); 133 | wc.lpszClassName = L"WindowClass"; 134 | 135 | RegisterClassEx(&wc); 136 | 137 | RECT wr = {0, 0, SCREEN_WIDTH, SCREEN_HEIGHT}; 138 | AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); 139 | 140 | hWnd = CreateWindowEx(NULL, 141 | L"WindowClass", 142 | L"Our First Direct3D Program", 143 | WS_OVERLAPPEDWINDOW, 144 | 300, 145 | 300, 146 | wr.right - wr.left, 147 | wr.bottom - wr.top, 148 | NULL, 149 | NULL, 150 | hInstance, 151 | NULL); 152 | 153 | ShowWindow(hWnd, nCmdShow); 154 | 155 | // set up and initialize Direct3D 156 | InitD3D(hWnd); 157 | 158 | // enter the main loop: 159 | 160 | MSG msg; 161 | 162 | while(TRUE) 163 | { 164 | if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) 165 | { 166 | TranslateMessage(&msg); 167 | DispatchMessage(&msg); 168 | 169 | if(msg.message == WM_QUIT) 170 | break; 171 | } 172 | 173 | RenderFrame(); 174 | } 175 | 176 | // clean up DirectX and COM 177 | CleanD3D(); 178 | 179 | return msg.wParam; 180 | } 181 | 182 | 183 | // this is the main message handler for the program 184 | LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 185 | { 186 | switch(message) 187 | { 188 | case WM_DESTROY: 189 | { 190 | PostQuitMessage(0); 191 | return 0; 192 | } break; 193 | } 194 | 195 | return DefWindowProc (hWnd, message, wParam, lParam); 196 | } 197 | 198 | 199 | // this function initializes and prepares Direct3D for use 200 | void InitD3D(HWND hWnd) 201 | { 202 | // create a struct to hold information about the swap chain 203 | DXGI_SWAP_CHAIN_DESC scd; 204 | 205 | // clear out the struct for use 206 | ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC)); 207 | 208 | // fill the swap chain description struct 209 | scd.BufferCount = 1; // one back buffer 210 | scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; // use 32-bit color 211 | scd.BufferDesc.Width = SCREEN_WIDTH; // set the back buffer width 212 | scd.BufferDesc.Height = SCREEN_HEIGHT; // set the back buffer height 213 | scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // how swap chain is to be used 214 | scd.OutputWindow = hWnd; // the window to be used 215 | scd.SampleDesc.Count = 4; // how many multisamples 216 | scd.Windowed = TRUE; // windowed/full-screen mode 217 | scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; // allow full-screen switching 218 | 219 | // create a device, device context and swap chain using the information in the scd struct 220 | D3D11CreateDeviceAndSwapChain(NULL, 221 | D3D_DRIVER_TYPE_HARDWARE, 222 | NULL, 223 | NULL, 224 | NULL, 225 | NULL, 226 | D3D11_SDK_VERSION, 227 | &scd, 228 | &swapchain, 229 | &dev, 230 | NULL, 231 | &devcon); 232 | 233 | 234 | // get the address of the back buffer 235 | ID3D11Texture2D *pBackBuffer; 236 | swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); 237 | 238 | // use the back buffer address to create the render target 239 | dev->CreateRenderTargetView(pBackBuffer, NULL, &backbuffer); 240 | pBackBuffer->Release(); 241 | 242 | // set the render target as the back buffer 243 | devcon->OMSetRenderTargets(1, &backbuffer, NULL); 244 | 245 | 246 | // Set the viewport 247 | D3D11_VIEWPORT viewport; 248 | ZeroMemory(&viewport, sizeof(D3D11_VIEWPORT)); 249 | 250 | viewport.TopLeftX = 0; 251 | viewport.TopLeftY = 0; 252 | viewport.Width = SCREEN_WIDTH; 253 | viewport.Height = SCREEN_HEIGHT; 254 | 255 | devcon->RSSetViewports(1, &viewport); 256 | 257 | InitPipeline(); 258 | InitGraphics(); 259 | } 260 | 261 | 262 | // this is the function used to render a single frame 263 | void RenderFrame(void) 264 | { 265 | // clear the back buffer to a deep blue 266 | devcon->ClearRenderTargetView(backbuffer, D3DXCOLOR(0.0f, 0.2f, 0.4f, 1.0f)); 267 | 268 | // select which vertex buffer to display 269 | UINT stride = sizeof(VERTEX); 270 | UINT offset = 0; 271 | devcon->IASetVertexBuffers(0, 1, &pVBuffer, &stride, &offset); 272 | 273 | // select which primtive type we are using 274 | devcon->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST); 275 | 276 | // draw the vertex buffer to the back buffer 277 | devcon->Draw(3, 0); 278 | 279 | // switch the back buffer and the front buffer 280 | swapchain->Present(0, 0); 281 | } 282 | 283 | 284 | // this is the function that cleans up Direct3D and COM 285 | void CleanD3D(void) 286 | { 287 | swapchain->SetFullscreenState(FALSE, NULL); // switch to windowed mode 288 | 289 | // close and release all existing COM objects 290 | pLayout->Release(); 291 | pVS->Release(); 292 | pPS->Release(); 293 | pVBuffer->Release(); 294 | swapchain->Release(); 295 | backbuffer->Release(); 296 | dev->Release(); 297 | devcon->Release(); 298 | } 299 | 300 | D3DXMATRIX 301 | ProjectionMatrix(const float near_plane, // Distance to near clipping 302 | // plane 303 | const float far_plane, // Distance to far clipping 304 | // plane 305 | const float fov_horiz, // Horizontal field of view 306 | // angle, in radians 307 | const float fov_vert) // Vertical field of view 308 | // angle, in radians 309 | { 310 | float h, w, Q; 311 | 312 | w = (float)1 / tan(fov_horiz*0.5); // 1/tan(x) == cot(x) 313 | h = (float)1 / tan(fov_vert*0.5); // 1/tan(x) == cot(x) 314 | Q = far_plane / (far_plane - near_plane); 315 | 316 | D3DXMATRIX ret; 317 | ZeroMemory(&ret, sizeof(ret)); 318 | 319 | ret(0, 0) = w; 320 | ret(1, 1) = h; 321 | ret(2, 2) = Q; 322 | ret(3, 2) = -Q * near_plane; 323 | ret(2, 3) = 1; 324 | return ret; 325 | } // End of ProjectionMatrix 326 | // this is the function that creates the shape to render 327 | void InitGraphics() 328 | { 329 | // create a triangle using the VERTEX struct 330 | VERTEX OurVertices[] = 331 | { 332 | { 333 | 0.0f, 0.5f*F, 0.0f, 334 | 0.0f, 0.0f, 0.0f, 335 | 0.0f, 0.0f, 0.0f, 0.0f, 336 | 0.0f, 0.0f, 337 | 0.0f, 0.0f, 338 | D3DXCOLOR(1.0f, 0.0f, 0.0f, 1.0f), 339 | 0.0f, 0.0f, 340 | 0 341 | }, 342 | { 343 | 0.45f*F, -0.5f*F, 0.0f, 344 | 0.0f, 0.0f, 0.0f, 345 | 0.0f, 0.0f, 0.0f, 0.0f, 346 | 0.0f, 0.0f, 347 | 0.0f, 0.0f, 348 | D3DXCOLOR(0.0f, 1.0f, 0.0f, 1.0f), 349 | 0.0f, 0.0f, 350 | 1 351 | }, 352 | { 353 | -0.45f*F, -0.5f*F, 0.5f*F, 354 | 0.0f, 0.0f, 0.0f, 355 | 0.0f, 0.0f, 0.0f, 0.0f, 356 | 0.0f, 0.0f, 357 | 0.0f, 0.0f, 358 | D3DXCOLOR(0.0f, 0.0f, 1.0f, 1.0f), 359 | 0.0f, 0.0f, 360 | 2 361 | } 362 | }; 363 | 364 | 365 | // create the vertex buffer 366 | D3D11_BUFFER_DESC bd; 367 | ZeroMemory(&bd, sizeof(bd)); 368 | 369 | bd.Usage = D3D11_USAGE_DYNAMIC; // write access access by CPU and GPU 370 | bd.ByteWidth = sizeof(VERTEX) * 3; // size is the VERTEX struct * 3 371 | bd.BindFlags = D3D11_BIND_VERTEX_BUFFER; // use as a vertex buffer 372 | bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; // allow CPU to write in buffer 373 | 374 | dev->CreateBuffer(&bd, NULL, &pVBuffer); // create the buffer 375 | 376 | 377 | // copy the vertices into the buffer 378 | D3D11_MAPPED_SUBRESOURCE ms; 379 | devcon->Map(pVBuffer, NULL, D3D11_MAP_WRITE_DISCARD, NULL, &ms); // map the buffer 380 | memcpy(ms.pData, OurVertices, sizeof(OurVertices)); // copy the data 381 | devcon->Unmap(pVBuffer, NULL); // unmap the buffer 382 | 383 | 384 | ZeroMemory(&bd, sizeof(bd)); 385 | 386 | bd.Usage = D3D11_USAGE_DYNAMIC; // write access access by CPU and GPU 387 | bd.ByteWidth = sizeof(CBViewProjection); 388 | bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; // use as a constant buffer 389 | bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; // allow CPU to write in buffer 390 | 391 | pvsConstData = new CBViewProjection(); 392 | //memcpy(&pvsConstData->fViewProj.m , ProjectionMatrix(0.0f,100000000.0f,M_PI/2,M_PI/2),sizeof(float)*16); 393 | memcpy(&pvsConstData->fViewProj.m, new float[16]{1,0,0,0 ,0,1,0,0 ,0,0,1,0 ,0,0,0,1}, sizeof(float) * 16); 394 | //memcpy(&pvsConstData->fViewProj.m, new float[16]{ 0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 }, sizeof(float) * 16); 395 | // Fill in the subresource data. 396 | D3D11_SUBRESOURCE_DATA initData; 397 | initData.pSysMem = pvsConstData; 398 | initData.SysMemPitch = 0; 399 | initData.SysMemSlicePitch = 0; 400 | 401 | HRESULT hres = dev->CreateBuffer(&bd, &initData, &pCBuffer); // create the buffer 402 | if (FAILED(hres)) { 403 | char error[100]; 404 | sprintf_s(error, "FAIL#2: %d [%08x]", GetLastError(), hres); 405 | MessageBoxA(0, error, error, 0); 406 | LPSTR messageBuffer = nullptr; 407 | size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 408 | NULL, hres, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL); 409 | 410 | MessageBoxA(0, messageBuffer, messageBuffer, 0); 411 | 412 | //Free the buffer. 413 | LocalFree(messageBuffer); 414 | 415 | } 416 | devcon->VSSetConstantBuffers(0, 1, &pCBuffer); 417 | 418 | D3D11_SHADER_RESOURCE_VIEW_DESC bdt; 419 | ZeroMemory(&bdt, sizeof(bdt)); 420 | ZeroMemory(&bd, sizeof(bd)); 421 | bd.Usage = D3D11_USAGE_DYNAMIC; // write access access by CPU and GPU 422 | bd.ByteWidth = sizeof(GInstanceBuffer); 423 | bd.BindFlags = D3D11_BIND_SHADER_RESOURCE; // use as a shader resource 424 | bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; 425 | bd.MiscFlags = 0; 426 | bd.StructureByteStride = 0; 427 | 428 | pgInstanceBuffer = new GInstanceBuffer(); 429 | //memcpy(&pvsConstData->fViewProj.m , ProjectionMatrix(0.0f,100000000.0f,M_PI/2,M_PI/2),sizeof(float)*16); 430 | memcpy(&pgInstanceBuffer->wmat.f, new float[12]{ 1,0,0,0 ,0,1,0,0 ,0,0,1,0 }, sizeof(float) * 16); 431 | //memcpy(&pvsConstData->fViewProj.m, new float[16]{ 0,0,0,0 ,0,0,0,0 ,0,0,0,0 ,0,0,0,0 }, sizeof(float) * 16); 432 | // Fill in the subresource data. 433 | 434 | initData.pSysMem = pgInstanceBuffer; 435 | initData.SysMemPitch = 0; 436 | initData.SysMemSlicePitch = 0; 437 | hres = dev->CreateBuffer(&bd, &initData, &pCBuffer); // create the buffer 438 | if (FAILED(hres)) { 439 | char error[100]; 440 | sprintf_s(error, "FAIL#4: %d [%08x]", GetLastError(), hres); 441 | MessageBoxA(0, error, error, 0); 442 | LPSTR messageBuffer = nullptr; 443 | size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 444 | NULL, hres, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL); 445 | 446 | MessageBoxA(0, messageBuffer, messageBuffer, 0); 447 | 448 | //Free the buffer. 449 | LocalFree(messageBuffer); 450 | 451 | } 452 | bdt.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; 453 | bdt.ViewDimension = D3D_SRV_DIMENSION_BUFFER; 454 | //bdt.Buffer.NumElements = 1; 455 | //bdt.Buffer.FirstElement = 0; 456 | bdt.Buffer.ElementWidth = 4; 457 | bdt.Buffer.ElementOffset = 0; 458 | ID3D11ShaderResourceView* pTexture2d; 459 | hres = dev->CreateShaderResourceView(pCBuffer, &bdt,&pTexture2d); // create the buffer 460 | if (FAILED(hres)) { 461 | char error[100]; 462 | sprintf_s(error, "FAIL#3: %d [%08x]", GetLastError(), hres); 463 | MessageBoxA(0, error, error, 0); 464 | LPSTR messageBuffer = nullptr; 465 | size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 466 | NULL, hres, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL); 467 | 468 | MessageBoxA(0, messageBuffer, messageBuffer, 0); 469 | 470 | //Free the buffer. 471 | LocalFree(messageBuffer); 472 | 473 | } 474 | devcon->VSSetShaderResources(0, 1, &pTexture2d); 475 | } 476 | 477 | ID3D10Blob* loadfile(const char* filePath) { 478 | ID3D10Blob* buf; 479 | FILE* f; 480 | fopen_s(&f,filePath, "rb"); 481 | fseek(f, 0, SEEK_END); 482 | DWORD fsize = ftell(f); 483 | D3DCreateBlob(fsize,&buf); 484 | fseek(f, 0, SEEK_SET); /* same as rewind(f); */ 485 | fread(buf->GetBufferPointer(), fsize, 1, f); 486 | fclose(f); 487 | return buf; 488 | } 489 | 490 | // this function loads and prepares the shaders 491 | void InitPipeline() 492 | { 493 | // load and compile the two shaders 494 | ID3D10Blob *VS, *PS; 495 | D3DX11CompileFromFile(L"d:\\tmp\\shaders\\src\\tools\\shaders.shader", 0, 0, "PShader", "ps_5_0", 0, 0, 0, &PS, 0, 0); 496 | int num; 497 | LPWSTR* argvw = CommandLineToArgvW(GetCommandLineW(), &num); 498 | 499 | if(num>1){ 500 | char path[256]; 501 | sprintf_s(path, "%ws", argvw[1]); 502 | VS = loadfile((const char*)&path); 503 | }else { 504 | D3DX11CompileFromFile(L"d:\\tmp\\shaders\\src\\tools\\shaders.shader", 0, 0, "VShader", "vs_5_0", 0, 0, 0, &VS, 0, 0); 505 | //VS = loadfile("d:\\tmp\\shaders\\601_mod2.shdr"); 506 | } 507 | // encapsulate both shaders into shader objects 508 | HRESULT hres = dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS); 509 | if (FAILED(hres)) { 510 | char error[100]; 511 | sprintf_s(error, "FAIL#1: %d [%08x]", GetLastError(), hres); 512 | MessageBoxA(0, error, error, 0); 513 | 514 | LPSTR messageBuffer = nullptr; 515 | size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 516 | NULL, hres, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL); 517 | 518 | MessageBoxA(0, messageBuffer, messageBuffer, 0); 519 | 520 | //Free the buffer. 521 | LocalFree(messageBuffer); 522 | 523 | } 524 | dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS); 525 | 526 | // set the shader objects 527 | devcon->VSSetShader(pVS, 0, 0); 528 | devcon->PSSetShader(pPS, 0, 0); 529 | 530 | // create the input layout object 531 | D3D11_INPUT_ELEMENT_DESC ied[] = 532 | { 533 | {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, 534 | {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, F3, D3D11_INPUT_PER_VERTEX_DATA, 0}, 535 | {"TANGENT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, F3 * 2, D3D11_INPUT_PER_VERTEX_DATA, 0}, 536 | {"UV_Primary", 0, DXGI_FORMAT_R32G32_FLOAT, 0, F3 * 2 + F4, D3D11_INPUT_PER_VERTEX_DATA, 0}, 537 | {"UV_Secondary", 0, DXGI_FORMAT_R32G32_FLOAT, 0, F3 * 2 + F4 + F2, D3D11_INPUT_PER_VERTEX_DATA, 0}, 538 | {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, F3 * 2 + F4 + F2 * 2, D3D11_INPUT_PER_VERTEX_DATA, 0}, 539 | {"PositionPF", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, F3 * 2 + F4 * 2 + F2 * 2, D3D11_INPUT_PER_VERTEX_DATA, 0}, 540 | {"SV_InstanceID", 0, DXGI_FORMAT_R32_UINT, 0, F3 * 3 + F4 * 2 + F2 * 2, D3D11_INPUT_PER_VERTEX_DATA, 0}, 541 | }; 542 | 543 | dev->CreateInputLayout(ied, 8, VS->GetBufferPointer(), VS->GetBufferSize(), &pLayout); 544 | devcon->IASetInputLayout(pLayout); 545 | } -------------------------------------------------------------------------------- /010 Templates/IBMRLTemplate.bt: -------------------------------------------------------------------------------- 1 | //------------------------------------------------ 2 | //--- 010 Editor v8.0.1 Binary Template 3 | // 4 | // File: 5 | // Authors: CrazyT 6 | // Version: 7 | // Purpose: 8 | // Category: 9 | // File Mask: *.mrl3 10 | // ID Bytes: 11 | // History: 12 | //------------------------------------------------ 13 | 14 | local char possibleStrings[] = "SSShadow,tShadowMap,gHotLightsSRV,gTileLightParamSRV,tileLighting,intervalPoints,intervalPointCount,froxelVolumes,froxelVolumesMulti,indirectCount,rwFroxels,CBViewProjection,CBScreen,CBLightParameters,CBVRCommon,CBVRCompute,SSVRLinear,tLuminance,tTransmittance,rwLuminance,rwTransmittance,CBVRFilter,SSDisplacement__disclosure,SSGeneric__disclosure,gJointMatrixBuffer,gUpdateBuffer,tRMTMap__disclosure,tDisplacementMap__disclosure,CBRenderFrame,CBModel,CBROPTest,CBUpdateBufferFromMeshData,CBMhMaterialEM105Local__disclosure,CBMhMaterialVfxDebufBodyLocal__disclosure,tColorTargetUAV,CBSystemColor,lightProbesRGB,lightProbesTocCollision,lightProbesTetraVertices,lightProbesNeighborIndices,lightProbesVertices,tBroadAreaShadowMap,CBLightProbes,CBLight,SSVRWrapPoint,rayVolumes,tileMultiList,tVolumeTex0,tVolumeTex1,tVolumeTex2,tVolumeTex3,rwIntervalPoints,rwFroxelVolumes,rwFroxelVolumesMulti,CBVRVolumeParams,tDepthMap,RwTileMaxH,CBNewDOFFilter,inputBufferSH3R,tOutputCubeIRM,CBInstancing,SSBase,tBaseMap,tPrimaryShadow,tSSShadowBlurMap,CBGaussian,CBAmbientOcclusion,tileSingleList,SSCubeToIRM,tIRMInputCube,ouputBufferSH3_TRGB,SSNormal__disclosure,SSEmissive__disclosure,tWaterReflectionDepth,gInstanceBufferMaterial,gInstanceIndexBuffer,tNormalMap__disclosure,tEmissiveMap__disclosure,CBMaterialCommon__disclosure,SSLinear,SSPoint,tBlendMap,tGBuffer1,tGBuffer4,tPrevGBufferID,rwOutput,CB_TemporalAA2,pix_clear_constants,SSRefraction,SSVolumeBlendDepth,SSProjectionLight,SSFogLinear,SSFogWrapLinear,SSSHDiffuse,SSWaterCustom,SSWaterCustomWrap,tRefractionMap,tVolumeBlendDepthMap,tVfxNormalBlend,tSpotProjection,tPrimaryProjection,tFogVolumeMap,tFogTable,tMipFogMain,tMipFogTarget,tMipFogTable,tSHDiffuse,tWaterCustomAlbedoMap,tWaterCustomNormalMap,tWaterCustomEmissiveMap,tWaterCustomRMTMap,tWaterCustomDetailNormalMap,tWaterCustomProjectionNormalMap,tWaterCustomFlowMap,tWaterCustomAlphaMap,tWaterCustomCubeMap,CBWaterCustomLight,CBFog,CBWaterMaterial,CBWaterCustom,inputTexture,outputCube,CBCubeCopy,SSPrimAlbedo,tPrimAlbedoMap,CBPrimSystem,CBPrimitive,SSSystemSnowHeight,SSSystemSnowHeightPoint,tDitherMap,tSystemSnowHeightMap,tSystemSnowNormalMap,gRWTexture,CBViewFrustum,CBTest,gMeshVertexBuffer,gRWUpdateBuffer,CBUpdateBufferFromMesh,CBUpdateBufferFromMeshConditions2,SSFilter,gLuminanceBufferSRV,CBLuminance,gActiveOcclusionUAV,tLightProbesShadowMap,tGBufferDepthMap,tGBuffer2,writeSHDiffuseOut,CBSHDiffuse,tGBuffer0,tGBuffer3,tSSShadowMap,tTiledDeferredOutput,gInstanceBuffer,gInstanceBufferPF,gWavePointBuffer,CBMhMaterialVfxWaveLocal__disclosure,CBMhMaterialVfxWave,SSAlbedo__disclosure,SSDetailNormal__disclosure,SSSplash__disclosure,tAlbedoMap__disclosure,tDetailNormalMap__disclosure,tSplashMap__disclosure,lightProbesDest,gJointMatrixBufferPF,CBTestLight,gPickCount,gPickData,CBPick,gPlantOnSurfaceIndexBuffer,gPlantOnSurfaceMatrixBuffer,gPlantOnSurfaceMatrixBufferPF,CB_PlantOnSurface,CBMhSkyGBuffer,gOcclusionVoxelInfo,gActiveOcclusionVoxelBufferUAV,gIndirectArgsUAV,CBPrimGpuOcclusionVoxelSystem,SSSystemSnowHeightDS,SSAlbedo,SSRMT,SSEmissive,tHeightMap,tAlbedoMap,tRMTMap,tEmissiveMap,tAlbedoBlendMapR,tRMTBlendMapR,tEmissiveMapR,tSnowFieldVolumeBlendDepthMap,tUnderAlbedoMap,CBSnowFieldMaterial,CBConstantHaltonSequence,CBCapsuleAO,CBCapsuleAOGeomParam,SSRMT__disclosure,CBMhMaterialFlowLavaLocal__disclosure,SSCube,SSDepth,tCubeMap,tPrecomputedBRDFMap,tSSLRTraceMap,tSSLR_BlurredMipMap,tDecalMaskMap,tSSLR_EffectRelectionMap,tSSLR_ResolveMapUAV,tSSLR_TemporalMapUAV,CBSSLR,srcFurVelocityBuffer,tRWSSAOUAV,tileDepth,rwIndirectCount,rwIntervalPointCount,rwTileUnused_nc__uavcounter,rwRayVolumes,rwTileSingle_nc__uavcounter,rwTileMulti_nc__uavcounter,CBLightShaft,gEmitters,gEmitterRange,gParticleData,gParticleDataIndex,gParticleBinary,gPrimCsOutVertex,gPrimCsOutIndex,tPrimSceneDepthMap,gPrimVertex,gPrimTemporal,gPrimLightProbes,CBPrimBufferDescription,SSPrimNormal,SSPrimSceneTex,SSPrimSceneTexDownSample,SSPrimCube,tPrimNormalMap,tPrimSceneTex,tPrimSceneTexDownSample,tPrimCubeMap,CBPrimitiveEx,SSSky,SSSkyCloud,SSSkySun,SSSkyStarrySky,SSSkyCurve,tSkyBaseMap,tSkySunRegionMap,tSkyCloudRegionMap,tSkyCloudsSideMap,tSkyCloudsTopMap0,tSkyCloudsTopMap1,tSkyBlendBaseMap,tSkyBlendSunRegionMap,tSkyBlendCloudRegionMap,tSkyBlendCloudsSideMap,tSkyBlendCloudsTopMap0,tSkyBlendCloudsTopMap1,tSkySunLightMaskMap,tSkyStarrySkyMap,tSkyCurveMap,CBMhSky2PS,CBPrimitivePick,gTiangleIndex,gActiveOcclusion,gOcclusionCellVertexBuffer,gOcclusionCellIndexBuffer,recomputeMap,tLuminanceRecompute,tTransmittanceRecompute,rwCheckerDepth,rwCheckerLuminance,rwCheckerTransmittance,SSVRPoint,rwHoldoutAlpha,recomputeList,tHTileTexture,tGBuffer5,tNeighborMax,CBMotionBlurReconstruction,tIRMInputCube2,outputCubeMip1,outputCubeMip2,outputCubeMip3,outputCubeMip4,outputCubeMip5,CBCubeBlend,CBWaterWave,SSSystemSnowHeightDepthTest,SSVertexColor,tSystemSnowHeightDepthMap,gSnowField4GeomInfo,tVertexColorMap,CBSystemSnow,CBSnowField4Geometry,CBWorkaround,SrcTexture,CoCSrc,CBBokehCOCSettings,SSColorMask__disclosure,SSAlbedoBlend__disclosure,SSAddNormal__disclosure,SSAddNormalMask__disclosure,SSPaint__disclosure,SSPanoramaMap__disclosure,SSDetailEmissive__disclosure,tColorMaskMap__disclosure,tFxMap__disclosure,tAddNormalMap__disclosure,tAddNormalMaskMap__disclosure,tPaintKzMap__disclosure,tPaintPbMap__disclosure,tMaskMap__disclosure,tPanoramaMap__disclosure,tDetailEmissiveMap__disclosure,tPartsMaskMap__disclosure,tSnowMap__disclosure,CBMhMaterialEMGlobal,SSNormal,SSDetailNormal,tNormalMap,tNormalBlendMapR,tBakedNormalMap,tUnderNormalMap,CBSnowField2Material,outputCubeMip6,outputCubeMip7,SSPrimAlphaMask,tPrimAlphaMask,CBMhMaterialVfxDistDispWLocal__disclosure,SSCube__disclosure,SSFlow__disclosure,tCubeMap__disclosure,tFlowMap__disclosure,gSrcVB,gDestVB,gDestNormal,CBComputeSkinning,CBBloom,SSFilterBlend,CBFilter,CBGUIGlobal,SSGUI,tGUIBaseMap,tGUIBlendMap,tGUIAlphaMap,tGUINormalMap,tGUIEmissiveMap,CBGUIGBuffer,TileMax,RwNeighbor,SSSystemCopy,ditherMap,tCheckerDepth,rwFinalL,rwFinalT,rwHoldoutDepth,tileUnused,clearL0,clearL1,clearL2,clearL3,CompressDOFImage,RwImage,CBWaterModel,tDepthMipMapTarget0,tDepthMipMapTarget1,tDepthMipMapTarget2,tDepthMipMapTarget3,tDepthMapOutput,tApproximateDepthMapOutput,CBSystem,TargetTextureSrv,TargetTextureUav,tSrcMap,tSrcMap2,rwDstMap,rwDstMap2,CBVRGaussian,IgnoreColorMask,MultColorAlphaSrc,CB_DL,CBSnowField3Geometry,gSourceVertexBuffer,gOutputVertexBuffer,CBShapeMesh,SSClampPoint,CoC,Image,Neighbor,RwCompressDOFImage,RwDOFAImage,tSSAO,gSrcIB,gRedirect,gDestAccum,CBNormalRecalc,gSunPixelCount,CBMhSky2Sun,tAmbientOccluder,CBAmbientOccluder,ditherList,gLightBitArraySRV,rwFroxelDebug,clearT0,clearT1,clearT2,clearT3,rwTileISP_Single_nc__uavcounter,rwTileI_Single_nc__uavcounter,rwTileIS_Single_nc__uavcounter,rwTileIP_Single_nc__uavcounter,rwTileS_Single_nc__uavcounter,rwTileSP_Single_nc__uavcounter,rwTileP_Single_nc__uavcounter,SSFur__disclosure,SSFx__disclosure,SSPattern__disclosure,SSAlbedoBlendMap__disclosure,tFurMap__disclosure,tPatternMap__disclosure,tAlbedoBlendMap__disclosure,CBMhMaterialEMSLocal__disclosure,CBMhMaterialGlobal,ComponentReSrc,ComponentImSrc,CBWater,SSWater,SSWaterWrap,tWaterBaseColor,tWaterBaseDepth,tWaterNormalA,tWaterNormalB,tWaterAlbedo,tWaterNormal,tWaterRoughness,tWaterCaustics,tWaterWhitecap,tWaterCubeMapA,tWaterCubeMapB,tLUT3DMap0,tLUT3DMap1,tLUT3DMap2,tLUT3DBlendMap,CBLUTBlending,CBVRRecompute,SSFurVelocity__disclosure,tFurVelocityMap__disclosure,CBMhMaterialStdLocal__disclosure,tVolumeFinalLuminance,tVolumeFinalTransmittance,CBVR_Debug,rwIndirectArgs,CoCAlphaSrc,FarResult,CBDOFFilter,CBImagePlane,CBImagePlane2,tFilterTempMap1,tDepthTargetUAV,holdout,froxels,tVolumeMap,CBHazeFilter,rwClearLumTrans0,rwClearLumTrans1,rwClearLumTrans2,rwClearLumTrans3,SSVertexPosition__disclosure,tVertexPositionMap__disclosure,tVertexNormalMap__disclosure,tVertexTangentMap__disclosure,CBMhMaterialVfxVATDistLocal__disclosure,SSOpacity__disclosure,tSceneEnvMap,tOpacityMap__disclosure,CBBokehComposite,CBDecal,CBMhMaterialFakeLensLocal__disclosure,CBFilter2,tWaterReflectionColor,CBMhMaterialVfxDispWaveLocal__disclosure,SSRefractionMask__disclosure,tRefractionMaskMap__disclosure,singleMultiHeatMap,NearResult,SSTranslucency__disclosure,tTranslucencyMap__disclosure,CBMhMaterialFlowDirLocal__disclosure,SSDevelop,CBDevelopFlags,rwDownsampleDither,rwDither_nc__uavcounter,gHotLights,gTileLightParam,NearMask,tColorTarget,tMipMapColorTarget0,tMipMapColorTarget1,tMipMapColorTarget2,tMipMapColorTarget3,CBCreateMipmap,RwTileMax,gToneMappingHistogramUAV,SSShoveler,shovelerTextureArray,PreSnowFieldDepth,gUpdateBuffer2,CBMhMaterialEM103Local__disclosure,tSSSSSMap,snapshotIndirectData,FarMask,gSortBuffer,CBBitonicSort,CBTSAO,tTiledDeferredNumber,CBDebug,CBMhMaterialDynamicSnow__disclosure,SSVertexColor__disclosure,tHeightMap__disclosure,tVertexColorMap__disclosure,gIndirectTempArgsUAV,CBPrimGpuSystem,gIndirectArgs,gParticleDataIndexUAV,SSP2O,CBGodRaysFilter,ComponentReSrc_Comp0,ComponentImSrc_Comp0,ComponentReSrc_Comp1,ComponentImSrc_Comp1,CBBloomSample,tCSZ,SSAlpha,SSDecalCube,SSDecalFlow,tAlphaMap,tDecalCubeMap,tDecalFlowMap,CBMhDecal,CBMhDecalSM,rwTileDepths,CBMhSky2VS,CBMhMaterialEM100_01Local__disclosure,tAlbedoOverMap__disclosure,SSBorderLinear,tOcclusionMap,CBGodRaysConfiguration,CBSSSSS,CBSSSSS_Profile,TraceDispatchBufferUAV,CBMaterialDebug,SSClampLinear,HDRImage,CBNewDOFFilter2,CBAtmosphere,tReductionDepthMap,tFullSSShadow,tUpsampledTexture,SSPrimOcclusionMap,tPrimDepthMap,CBPrimitiveMetaDataOcclusion,CBSparkleParam,tInput,tHistory,tTransparentDensity,tEffectDensity,rwOuput,rwHistory,CBMhMaterialEM100Local__disclosure,CBMhMaterialLandscapeLocal__disclosure,tAlbedoBlendMapR__disclosure,tNormalBlendMapR__disclosure,tRMTBlendMapR__disclosure,tEmissiveMapR__disclosure,tAlbedoBlendMapG__disclosure,tNormalBlendMapG__disclosure,tRMTBlendMapG__disclosure,tEmissiveMapG__disclosure,tAlbedoBlendMapB__disclosure,tNormalBlendMapB__disclosure,tRMTBlendMapB__disclosure,tEmissiveMapB__disclosure,rwTileISP_Multi_nc__uavcounter,rwTileI_Multi_nc__uavcounter,rwTileIS_Multi_nc__uavcounter,rwTileIP_Multi_nc__uavcounter,rwTileS_Multi_nc__uavcounter,rwTileSP_Multi_nc__uavcounter,rwTileP_Multi_nc__uavcounter,CBLightShaft_LightParam,CBMhMaterialLandscapeFlowLocal__disclosure,SSVfxNormal__disclosure,CBLGTPRBDebug,CBHermiteCurve,gErrorUnitCount,gErrorUnitData,rwErrorUnitTexture,CBErrorUnit,SSWaterWave,CBSnowField2Debug,CBSnowFieldBake,srcVelocityBuffer,tHeight,CBHeightToNormal,tCOCMap,tFilteredCOCMap,tColorFilter0,tColorFilter1,CBColorCorrectCube,CBPrimCopyState,CBGUIDevelop,DOFAImage,tToneCurveMap,CBColorCorrect,tVoltexMap__disclosure,CBMhMaterialEM115Local__disclosure,SSWaterWaveWrap,tWaterNormal2,tWaterCausticsMap,tWaterNoise,tWaterCubemap0,tWaterCubemap1,CBWaterWaveMaterial,CBWaterDebug,rwReset0,rwReset1,CBGodRaysIterator,tDOFMap,SSSphere__disclosure,tSphereMap__disclosure,CBMhMaterialFakeEyeLocal__disclosure,gStarInfoBuffer,CBStarrySky,gGpuLogUAV,collisionUsage,CBMhMaterialEM109Local__disclosure,CBUpdateBufferFromMeshConditions,CBMhMaterialSZK001Local__disclosure,gBuffer,gDebugHistogram,inputBufferSH3_TRGB,ouputBufferSH3RGB,CBLGTPRBGen,tHoldout,tHoldoutDepth,rwHoldout,rwRecomputeMap,rwRecomputeList_nc__uavcounter,t3DLUTOutput,CBLUTMaking,tPreDepth,tDepthOut,CBSnowPreProcess,gActiveOcclusionVoxelBuffer,gOcclusionCellOffsetBuffer,PSFTextureSrv,CBBloomSettings,CBPrimitiveDebug,CBMaterialSnow__disclosure,tPickHeightMap,gSnowHeightPickData,CBSnowHeightPick,SSColorGrading,CBToneMapping,SSBlend,CB_TemporalAA,CBMhMaterialNPCEyeLocal__disclosure,SSPrimTurbulence,gEmitterBinary,gEmitterData,gShapeVertexBuffer,gShapeIndexBuffer,gLayoutCacheBuffer,tTurbulenceVolume0,tTurbulenceVolume1,tTurbulenceVolume2,tTurbulenceVolume3,tTurbulenceVolume4,tTurbulenceVolume5,tTurbulenceVolume6,tTurbulenceVolume7,gForceField,gParticleDataUAV,gParticleBinaryUAV,gCollisionSpaceHeadUAV,gCollisionSpaceEndUAV,CBSpeedTreeLocalWind,SSWrapLinear,SSBorderPoint,tFilterTempMap2,TileMaxH,gEmitterUsedIndices,gEmitterDataUAV,gEmitterRangeUAV,tCASInput,tCASOutput,CBCAS,CBSnowFieldGeometry,tHTileTextureUAV,CBSnowShoveler,CBSnowFall,SSHeatMap,tHeatMap,rwClearRecomputeMap0,tMipMapTarget0,tMipMapTarget1,tMipMapTarget2,tMipMapTarget3,tMipMapOutput,CBMhMaterialEM002Local__disclosure,gParticleUnusedIndicesUAV,tGlobalCubeOnly,gPrimCsTemporal,CBMhMaterialNPCHairLocal__disclosure,tSkyTempSunAlphaMap,CBMhMaterialEM024Local__disclosure,FarAlphaSrc,targetDepthValue,CBBokehAutoFocus,CBTexturePosScaleFactor,fastCopySource,fastCopyTarget,CBMhMaterialSimpleLocal__disclosure,SSSkin__disclosure,tSkinMap__disclosure,CBMhMaterialPLSkinLocal__disclosure,srcVelocityGBuffer,srcFurVelocityGBuffer,gSrcAccum,CBNormalMerge,rwPrevGBufferID,tColorOutput,SSMaterialBlend__disclosure,tNormalBlendMap__disclosure,tDetailNormalBlendMap__disclosure,tEmissiveBlendMap__disclosure,tMaterialBlendMap__disclosure,tRMTBlendMap__disclosure,CBMhMaterialStdBlendNoFurLocal__disclosure,tGUIFadeMap,CBGUINoiseAndFade,CBMhMaterialEM063Local__disclosure,CBDecalCommon,CBMhSkyVS,SSSkyBase,tSkySunMap,tSkySunAlphaMap,tSkyCloudMap0,tSkyCloudMap1,tSkyCloudMap2,tSkyCloudMap3,tSkyBlendCloudMap0,tSkyBlendCloudMap1,tSkyBlendCloudMap2,tSkyBlendCloudMap3,CBMhSkyLpPS,SSSnowFieldPreDepth,tSnowField0,tSnowField1,tSnowField2,tSnowField3,tSnowField4,tSnowField5,tSnowField6,tSnowField7,tSnowField8,tSnowField9,tSnowField10,tSnowField11,tSnowField12,tSnowField13,tSnowField14,tSnowField15,tRWPreDepth,CBSnowFieldPreDepth,gSpeedTreeVertexBuffer,CBSpeedTreeCollision__disclosure,CBSpeedTreePrimitiveInfo,CBSpeedTreeSystem,CBMhMaterialSpeedTreeStdBlendLocal__disclosure,CBSpeedTree,CBSpeedTreeGlobalWind,CBSpeedTreeGlobalWindPF,gSpeedTreeLocalWindIndexBuffer,gSpeedTreeLocalWindIndexBufferPF,CBSpeedTreeLocalWindPF,SSAtmosphereDepth,tAtmosphereOpticalDepthMap,tAerosolOpticalDepthMap,tPrecomputedRayleighOutput,tPrecomputedMieOutput,CBGlobalIllumination,tTileMax,CBMhMaterialVfxWaterLocal__disclosure,CBBlink,froxelDebug,gImpactIvyFloorPointBuffer,gImpactIvyFloorPointBufferPF,CBMhMaterialIvyFloorLocal__disclosure,CBMhMaterialIvyFloor,inputBuffer,CBGUIDistanceField,CBMhMaterialEC021Local__disclosure,gOcclusionCellBuffer,CBMhMaterialSpeedTreeStdFurLocal__disclosure,gSpeedTreeBoundingBuffer,gSpeedTreeCsLocalWindIndexBuffer,gBab,CBCSClear,tGUINoiseMap,tGUIEdgeMap,CBGUIIcon,CBMhMaterialSlantFloorLocal__disclosure,CBMhMaterialSlantFloor,CBMhSky2GBuffer,CBLuminanceDebugDisp,t2DLUTOutput,tOutlineObjectMap,tOutlineObjectDepthMap,CBOutline,gVoxelMeshIndex,CBMhMaterialEM125Local__disclosure,tHistoryMap,tBaseAoMap,tAoOutput,CB_BGTexture,CBMhMaterialFakeInnerEmitLocal__disclosure,CBWaterPick,CBMhMaterialEM011Local__disclosure,SSSkySunBloom,tSkySunMaskMap,rwSunPixelCount,ouputBufferSH3_TR,CBMhMaterialNPCFaceLocal__disclosure,gBufferHBT,gRWBufferHBT,CBMotionBlur,CBMhMaterialVfxTornadoLocal__disclosure,SSFaceMap__disclosure,tContactShadowDepthMap,tFaceNormalMap__disclosure,tFacePaintMap__disclosure,tFaceMayuMap__disclosure,CBContactShadowInfo,CBMhMaterialNPCEditFaceLocal__disclosure,gColorPickTexture,rwColorPick,CBDevelopColorPick,CBMhMaterialVfxSandFallLocal__disclosure,tOpacityBlendMap__disclosure,SSSnowMaterialBlend__disclosure,tSnowAlbedoMap__disclosure,tSnowNormalBlendMap__disclosure,tSnowDetailNormalBlendMap__disclosure,tSnowEmissiveBlendMap__disclosure,tSnowMaterialBlendMap__disclosure,tSnowRMTBlendMap__disclosure,CBMhMaterialSpeedTreeStdBlendSnowLocal__disclosure,CBMhMaterialEM106Local__disclosure,CBMhMaterialPLEditFaceLocal__disclosure,SSDetail__disclosure,tDetailMapA__disclosure,tDetailMapB__disclosure,tDetailMapC__disclosure,tDetailMapD__disclosure,CBMhMaterialEM044Local__disclosure,tTexture,tRWTexture1,tRWTexture2,tRWTexture3,tRWTexture4,CBMhMaterialPLHairLocal__disclosure,CBMhMaterialArrayLocal__disclosure,SSArrayMap__disclosure,tArrayMap__disclosure,CBVignetting,tTSAODepthMapOutput,tTSAODepthMipMapTarget0,tTSAODepthMipMapTarget1,tTSAODepthMipMapTarget2,tTSAODepthMipMapTarget3,ManualCoCSrc,MaskUAV,FarAlphaDst,MultColorAlphaDst,tDstBaseMap,CBMhEmissiveFog__disclosure,SSAlpha__disclosure,tAlphaMap__disclosure,CBMhMaterialSpeedTreeStdLocal__disclosure,CBMhMaterialNPCSkinLocal__disclosure,tColorSrc,tColorDst,CBMhMaterialScrWaterLocal__disclosure,CBMhSky2SimpleVS,CBMhSky2SimplePS,CBPartialColor,CoCAlphaDst,CBToneMappingSdrSim,inputCount,CB_CombinedFilter_ImagePlane,tColorFilterTable,tTemporalMap,tCombinedTemporalMap,CB_CombinedFilter,CB_CombinedFilter_ColorCorrect,inputCubeTemp,tFullDepthMap,cbHBAO,CBMhMaterialFlagWaveBlendLocal__disclosure,CBMhMaterial_EM105_EVCLocal__disclosure,inputCubeTemp2,outputCubeMip0,CBMhMaterialVfxFakeInnerLocal__disclosure,cbHDAO,CBMhMaterialScrIceBlendNoFurLocal__disclosure,CBMhMaterialEM117Local__disclosure,tCbr,tRWCbr,rwReset2,gRWRangeCheck,lightProbesR,CBMhMaterialSKM001Local__disclosure,CBMhMaterialEM036Local__disclosure,CBConstant,CBMhMaterialNikuLocal__disclosure,tDstDepth,CBMhMaterialEM102Local__disclosure,gPrimCsInHeader,gPrimCsInVertex,tTileMaxHorizontal,tRWTileMax,CBMhMaterialPLLocal__disclosure,rwSingleMultiHeatMap,SSSkyBlend,tSkyMap,tSkyAlphaMap,tSkyBlendMap,tSkyBlendAlphaMap,CBMhSkyPS,gRWStarVertex,rwTargetStats,CBMhMaterialScrIceBlendLocal__disclosure,SSFurNormal__disclosure,tFurNormalMap__disclosure,tFurMaskMap__disclosure,CBMhSky2SimpleGBuffer,HTileBuffer,CBMhMaterialFurLocal__disclosure,CBMhMaterialIridescentBlendLocal__disclosure,CBMhMaterialEM057Local__disclosure,tBaseMaps,CBDepthColor,CBMhMaterialStdBlendLocal__disclosure,CBMhMaterialEM111Local__disclosure,tFinalLuminance,tFinalTransmittance,tCOCMipMapTarget3,CBMhMaterialUberLocal__disclosure,SSColorDiv__disclosure,gParticleUnusedIndices,CBMhMaterialVfxDistDispLocal__disclosure,gToneMappingHistogramSRV,gLuminanceBuffer,CBMhMaterialEMLocal__disclosure,RwCoC,CBMhMaterialSpeedTreeStdIceLocal__disclosure,CBMhMaterialNPCLocal__disclosure,CBResample,CBMhMaterialEM124Local__disclosure,SSNormalHeightMap__disclosure,tNormalHeightMap__disclosure,SSAtmosphereScatter,tPrecomputedRayleighSRV,tPrecomputedMieSRV,CBSky,CBMhMaterialTestLocal__disclosure,tFurBlendMap__disclosure,tFurNormalBlendMap__disclosure,CBMhMaterialFurnitureLocal__disclosure,tDensityMap,CBMhMaterialPLEyeLocal__disclosure,CBMhMaterialBurnLocal__disclosure,SSSnowMap__disclosure,gOriginalVB,gDeformedVB,SeaDisplacement,CBMhMaterialSpeedTreeStdSnowLocal__disclosure,tSSLRTraceMapUAV,SSPrimTubeLightTexture,gTubeLights,tTubeLightTexture0,tTubeLightTexture1,tTubeLightTexture2,tTubeLightTexture3,CBTubeLight,CBMhMaterialFakeRefractionLocal__disclosure,tTargetDepth,CBImageEvaluator,CBMhMaterialEM118Local__disclosure,CBMhMaterialEM080Local__disclosure,tAlbedoUniqueMap__disclosure,tAlbedoExtendMap__disclosure,gChainMotionData,CBModelChain,tBlurTarget,inputShovelerData,gOutputUAV,CBLayoutCache,WaveParameters,tRWHeightMap,SSSnowHeightNormal,tDepthIn,tNormalOut,SSRadialFilterClampLinear,CBRadialBlurFilter,CBRadialBlurFunction,CBMhMaterialEM032Local__disclosure,CBPickObject,CBMhMaterialVfxAuroraLocal__disclosure,tRWNeighborMax,CBMhMaterialVfxIceLocal__disclosure,inputBufferSH3_TR,ouputBufferSH3R,CBMhMaterialFlagWaveLocal__disclosure,texSampler,tLuma,tChroma,CBFXAAParam,CBSystemGamma,inputBufferSH3RGB,gLightBitArray,CBHermiteCurveRGB,CBMhMaterialScrIceLocal__disclosure,CBMhMaterialBTK001Local__disclosure,SSSnowSystemCopy,tSnowHeightMap,CBMhMaterialFakeSphereLocal__disclosure,CBMhMaterialEM080_01Local__disclosure,CBMhMaterialUberIceLocal__disclosure,gPrimCsInMaterials,tRWTileMaxHorizontal,CBColorCorrectToneCurve,CBMhMaterialVfxFloodLocal__disclosure"; 15 | 16 | uint createJamcrc(char name[]){ 17 | local uchar result[5]; 18 | local uint a1; 19 | local uint a2; 20 | local uint a3; 21 | local uint a4; 22 | ChecksumAlgArrayBytes(CHECKSUM_CRC32,result,name,Strlen(name),"",-1,-1); 23 | a1 = result[0]; 24 | a2 = result[1]; 25 | a3 = result[2]; 26 | a4 = result[3]; 27 | return 0xFFFFFFFF ^ ((a1<<24) | (a2<<16) | (a3<< 8) | (a4)); 28 | } 29 | 30 | local int MAX_HASH_LENGTH=2000; 31 | local int hashes[MAX_HASH_LENGTH]; 32 | local int starts[MAX_HASH_LENGTH]; 33 | local int lengths[MAX_HASH_LENGTH]; 34 | local int idx1 = 1000; 35 | local int Hidx = 0; 36 | local char possibleStringsTmp[] = possibleStrings; 37 | local char name[]; 38 | local int crcTestLen; 39 | local uint64 jamcrc; 40 | starts[0] = 0; 41 | while(idx1>0){ 42 | idx1 = Strchr(possibleStringsTmp,','); 43 | //local int idx2 = Strchr(StrDel(possibleStrings,0,idx1+1),','); 44 | //local int crcTestLen = ChecksumAlgArrayBytes(CHECKSUM_CRC32,result,"CB_BGTexture",12,"",0x04C11DB7,-1); 45 | name = StrDel(possibleStringsTmp,idx1,Strlen(possibleStringsTmp)); 46 | lengths[Hidx] = Strlen(name); 47 | hashes[Hidx] = createJamcrc(name); 48 | starts[Hidx+1] = starts[Hidx]+idx1+1; 49 | possibleStringsTmp = StrDel(possibleStringsTmp,0,idx1+1); 50 | Hidx++; 51 | /*if(Hidx==2){ 52 | break; 53 | }*/ 54 | } 55 | MAX_HASH_LENGTH = Hidx; 56 | 57 | struct ResBind; 58 | struct ResBind{ 59 | ubyte type; 60 | ubyte unkn1; 61 | ubyte unkn2; 62 | ubyte unkn3; 63 | uint32 x; 64 | //not so shure if this is correct 65 | uint texIdx; 66 | uint unkn5; 67 | }; 68 | 69 | 70 | struct Header{ 71 | long id; 72 | byte unkn1[0x0C]; 73 | uint materialCount; 74 | uint textureCount; 75 | uint64 textureOffset; 76 | uint64 materialOffset; 77 | }; 78 | struct Texture{ 79 | // fileTypeCode for tex is [(zlib.crc32("rTexture".encode()) ^ 0xffffffff) & 0x7fffffff] 80 | uint fileTypeCode; 81 | byte unkn2[12]; 82 | char path[256]; 83 | }; 84 | struct Material{ 85 | uint headId; 86 | //for example (zlib.crc32("NPC_Mt__4".encode()) ^ 0xffffffff) & 0x7fffffff 87 | uint materialNameHash; 88 | uint shaderHash; 89 | uint skinid; 90 | uint matSize; 91 | short unkn4; 92 | ubyte floatArrOff; 93 | ubyte unkn5[9]; 94 | ubyte unkn6; 95 | ubyte unkn7[15]; 96 | uint startAddr; 97 | uint unkn8; 98 | }; 99 | 100 | string ReadMaterial(Material& v){ 101 | string s; 102 | string s2=""; 103 | if(v.headId==0x4516E7AB){ 104 | s2 = "nDraw::Material"; 105 | } 106 | SPrintf( s, "%s skinid:%08x shaderHash:%08x",s2,v.skinid,v.shaderHash); 107 | return s; 108 | } 109 | 110 | 111 | 112 | 113 | #include "mhwib_structures_generated.bt" 114 | 115 | struct MaterialA(int count){ 116 | Material material[count]; 117 | }; 118 | struct ResBindA(int count){ 119 | ResBind resBind[count]; 120 | }; 121 | string ReadTexture(Texture& t){ 122 | return t.path; 123 | } 124 | string ReadHeader(Header& h){ 125 | return "rMaterial"; 126 | } 127 | 128 | 129 | Header head; 130 | Texture textures[head.textureCount]; 131 | 132 | 133 | string translate(uint32 partialHash){ 134 | string s = ""; 135 | for(i=0;i> 12; 150 | if(v.texIdx-1; 178 | for(i=0;i; 182 | left = (material.material[i].matSize-material.material[i].floatArrOff*8)/4; 183 | for(j=0;j> 12); 187 | sz = FTell()-oldpos; 188 | left -= sz/4; 189 | if(FTell() % 16>0){ 190 | left -= 16-FTell() % 16; 191 | FSeek(FTell()+(16-FTell() % 16)); 192 | } 193 | } 194 | } 195 | if(left>0){ 196 | struct FloatArr{ 197 | float floatVal[left]; 198 | }floatArr; 199 | } 200 | } 201 | --------------------------------------------------------------------------------