├── .gitattributes
├── .gitignore
├── LICENSE.txt
├── xivModdingFramework.sln
└── xivModdingFramework
├── App.config
├── Cache
├── ConsoleConfig.cs
├── FrameworkExceptions.cs
├── XivCache.cs
├── XivDependencyGraph.cs
└── XivDependencyRoot.cs
├── Exd
├── Enums
│ └── XivEx.cs
└── FileTypes
│ ├── Ex.cs
│ └── ExColumnExpectations.cs
├── General
├── CMP.cs
├── DataContainers
│ ├── CharaMakeParameter.cs
│ └── SearchResults.cs
├── Enums
│ ├── XivCategory.cs
│ ├── XivDataFile.cs
│ ├── XivLanguage.cs
│ └── XivRace.cs
├── GameInfo.cs
├── Quad.cs
└── XivModelChara.cs
├── HUD
└── FileTypes
│ └── Uld.cs
├── Helpers
├── BinaryReaderBE.cs
├── Constants.cs
├── DxtUtil.cs
├── HashGenerator.cs
├── IOUtil.cs
├── PenumbraAPI.cs
├── PenumbraAttachHandler.cs
└── ProblemChecker.cs
├── Items
├── Categories
│ ├── Character.cs
│ ├── Companions.cs
│ ├── Gear.cs
│ ├── Housing.cs
│ └── UI.cs
├── DataContainers
│ ├── XivCharacter.cs
│ ├── XivFurniture.cs
│ ├── XivGear.cs
│ ├── XivGenericItemModel.cs
│ ├── XivMinion.cs
│ ├── XivModelInfo.cs
│ ├── XivMonsterModelInfo.cs
│ ├── XivMount.cs
│ ├── XivPet.cs
│ └── XivUi.cs
├── Enums
│ └── XivItemType.cs
├── Interfaces
│ ├── IItem.cs
│ └── IItemModel.cs
└── ItemType.cs
├── Materials
├── DataContainers
│ ├── ShaderHelpers.cs
│ └── XivMtrl.cs
└── FileTypes
│ ├── Mtrl.cs
│ └── STM.cs
├── Models
├── DataContainers
│ ├── AttributeDataBlock.cs
│ ├── BoneDataBlock.cs
│ ├── BoneIndexMesh.cs
│ ├── BoneTransformData.cs
│ ├── BoundingBox.cs
│ ├── ColladaData.cs
│ ├── EModelingTool.cs
│ ├── EquipmentParameter.cs
│ ├── ExtraSkeletonEntry.cs
│ ├── LevelOfDetail.cs
│ ├── MaterialDataBlock.cs
│ ├── MdlModelData.cs
│ ├── MdlPathData.cs
│ ├── MeshData.cs
│ ├── MeshDataInfo.cs
│ ├── MeshPart.cs
│ ├── ModelTextureData.cs
│ ├── NeckMorphEntry.cs
│ ├── ShapeData.cs
│ ├── SkeletonData.cs
│ ├── TTModel.cs
│ ├── TerrainShadowMeshData.cs
│ ├── UnknownData0.cs
│ ├── UnknownData2.cs
│ ├── UnknownDataPatch72.cs
│ ├── VertexData.cs
│ ├── VertexDataStruct.cs
│ └── XivMdl.cs
├── Enums
│ ├── VertexDataType.cs
│ └── VertexUsageType.cs
├── FileTypes
│ ├── Eqp.cs
│ ├── Est.cs
│ ├── Mdl.cs
│ ├── MdlVertexReader.cs
│ ├── Obj.cs
│ ├── PDB.cs
│ └── Sklb.cs
├── Helpers
│ └── ModelModifiers.cs
└── ModelTextures
│ └── ModelTexture.cs
├── Mods
├── DataContainers
│ ├── BackupModPackData.cs
│ ├── ModGroup.cs
│ ├── ModList.cs
│ ├── ModOption.cs
│ ├── ModPackData.cs
│ ├── ModPackJson.cs
│ ├── OriginalModList.cs
│ ├── OriginalModPackJson.cs
│ ├── SimpleModPackData.cs
│ └── TransactionModList.cs
├── EndwalkerUpgrade.cs
├── Enums
│ └── EModState.cs
├── FileTypes
│ ├── ItemMetadata.cs
│ ├── ModelKit.cs
│ ├── PMP.cs
│ ├── PmpExtensions.cs
│ ├── PmpManipulation.cs
│ └── TTMP.cs
├── Interfaces
│ └── IModPackData.cs
├── ModTransaction.cs
├── Modding.cs
├── ModpackUpgrader.cs
├── RootCloner.cs
├── ShrinkRay.cs
├── SmartImport.cs
├── TTMPWriter.cs
├── TxBoiler.cs
└── WizardData.cs
├── Resources
├── DB
│ ├── item_sets.db
│ ├── shader_info.db
│ └── uv_heuristics.db
├── DefaultTextures
│ ├── Colorset.dat
│ ├── Colorset.dds
│ ├── Diffuse.dds
│ ├── Multi.dds
│ ├── Normal.dds
│ ├── Other.dds
│ ├── Specular.dds
│ ├── default_material.mtrl
│ └── default_material_dt.mtrl
├── GeneralStrings.Designer.cs
├── GeneralStrings.resx
├── SQL
│ ├── CreateCacheDB.sql
│ ├── CreateImportDB.sql
│ ├── CreateRootCacheDB.sql
│ ├── CreateShaderDB.sql
│ └── ShrinkShaderCache.sql
├── ShaderConstants
│ ├── character.json
│ └── skin.json
├── ShaderKeys.json
├── XivStrings.Designer.cs
├── XivStrings.de.resx
├── XivStrings.en.resx
├── XivStrings.fr.resx
├── XivStrings.ja.resx
├── XivStrings.ko.resx
├── XivStrings.resx
└── XivStrings.zh.resx
├── SqPack
├── DataContainers
│ ├── IndexFile.cs
│ └── TransactionIndexFile.cs
└── FileTypes
│ ├── Dat.cs
│ ├── Index.cs
│ └── TransactionDataHandler.cs
├── Textures
├── DataContainers
│ ├── TexTypePath.cs
│ └── XivTex.cs
├── Enums
│ ├── XivTexFormat.cs
│ └── XivTexType.cs
├── FileTypes
│ ├── ATex.cs
│ ├── DDS.cs
│ └── Tex.cs
└── TextureHelpers.cs
├── VFX
└── FileTypes
│ └── Avfx.cs
├── Variants
├── DataContainers
│ └── XivImc.cs
└── FileTypes
│ └── Imc.cs
├── World
├── Enums.cs
├── InstanceObject.cs
├── Layer.cs
└── Sgb.cs
└── xivModdingFramework.csproj
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
262 | /xivModdingFramework.xUnit
263 | /exChecker
264 |
--------------------------------------------------------------------------------
/xivModdingFramework.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27428.2015
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "xivModdingFramework", "xivModdingFramework\xivModdingFramework.csproj", "{83A720A7-A039-4FE3-BE65-95146CF5C6F3}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xivModdingFramework.xUnit", "xivModdingFramework.xUnit\xivModdingFramework.xUnit.csproj", "{4214BC4D-2FAD-4C9A-9F60-06A3EB22820D}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "exChecker", "exChecker\exChecker.csproj", "{D174095D-1B25-471A-B443-83D69E0A3173}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {83A720A7-A039-4FE3-BE65-95146CF5C6F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {83A720A7-A039-4FE3-BE65-95146CF5C6F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {83A720A7-A039-4FE3-BE65-95146CF5C6F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {83A720A7-A039-4FE3-BE65-95146CF5C6F3}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {4214BC4D-2FAD-4C9A-9F60-06A3EB22820D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {4214BC4D-2FAD-4C9A-9F60-06A3EB22820D}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {4214BC4D-2FAD-4C9A-9F60-06A3EB22820D}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {4214BC4D-2FAD-4C9A-9F60-06A3EB22820D}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {D174095D-1B25-471A-B443-83D69E0A3173}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {D174095D-1B25-471A-B443-83D69E0A3173}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {D174095D-1B25-471A-B443-83D69E0A3173}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {D174095D-1B25-471A-B443-83D69E0A3173}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {BDFB9BEC-EE96-43CD-A227-E288399EC7E2}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/xivModdingFramework/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/xivModdingFramework/Cache/ConsoleConfig.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.IO;
4 | using System.Threading.Tasks;
5 | using xivModdingFramework.General.Enums;
6 | using xivModdingFramework.Helpers;
7 |
8 | namespace xivModdingFramework.Cache
9 | {
10 | ///
11 | /// Simple class for storing basic configuration information in the working directory.
12 | /// This is a basic way for framework applications to hook the Framework without having to manually
13 | /// supply things like game path which may already be configured by TexTools/etc.
14 | ///
15 | public class ConsoleConfig
16 | {
17 | public const string ConfigPath = "console_config.json";
18 |
19 | public string XivPath { get; set; } = "";
20 |
21 | public string Language { get; set; } = "en";
22 |
23 | [JsonIgnore]
24 | public XivLanguage XivLanguage
25 | {
26 | get
27 | {
28 | try
29 | {
30 | return XivLanguages.GetXivLanguage(Language);
31 | }
32 | catch
33 | {
34 | return XivLanguage.English;
35 | }
36 | }
37 | }
38 |
39 |
40 | public static void Update(Action action)
41 | {
42 | var c = Get();
43 | action(c);
44 | c.Save();
45 | }
46 |
47 | public static ConsoleConfig Get()
48 | {
49 | var cwd = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
50 | var path = Path.Combine(cwd, ConfigPath);
51 |
52 | if (!File.Exists(path))
53 | {
54 | return new ConsoleConfig();
55 | }
56 |
57 | try
58 | {
59 | return JsonConvert.DeserializeObject(File.ReadAllText(path));
60 | }
61 | catch
62 | {
63 | return new ConsoleConfig();
64 | }
65 | }
66 |
67 | public void Save()
68 | {
69 | var cwd = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
70 | var path = Path.Combine(cwd, ConsoleConfig.ConfigPath);
71 | var text = JsonConvert.SerializeObject(this, Formatting.Indented);
72 | File.WriteAllText(path, text);
73 | }
74 |
75 |
76 | public static async Task InitCacheFromConfig(bool runWorker = false)
77 | {
78 | var c = Get();
79 | if (string.IsNullOrWhiteSpace(c.XivPath))
80 | {
81 | throw new ArgumentException("Console Config file does not have a valid FFXIV File path configured.");
82 | }
83 | await XivCache.SetGameInfo(new DirectoryInfo(c.XivPath), c.XivLanguage, runWorker);
84 |
85 | // Set a unique temp path.
86 | var tempDir = IOUtil.GetUniqueSubfolder(Path.GetTempPath(), "xivct");
87 | XivCache.FrameworkSettings.TempDirectory = tempDir;
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/xivModdingFramework/Cache/FrameworkExceptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using static xivModdingFramework.Cache.FrameworkExceptions;
5 |
6 | namespace xivModdingFramework.Cache
7 | {
8 | internal class FrameworkExceptions
9 | {
10 | public class ModdingFrameworkException : Exception
11 | {
12 | public ModdingFrameworkException()
13 | {
14 | }
15 |
16 | public ModdingFrameworkException(string message)
17 | : base(message)
18 | {
19 | }
20 |
21 | public ModdingFrameworkException(string message, Exception inner)
22 | : base(message, inner)
23 | {
24 | }
25 | }
26 |
27 | public class OffsetException : ModdingFrameworkException
28 | {
29 | public OffsetException()
30 | {
31 | }
32 |
33 | public OffsetException(string message)
34 | : base(message)
35 | {
36 | }
37 |
38 | public OffsetException(string message, Exception inner)
39 | : base(message, inner)
40 | {
41 | }
42 | }
43 | public class HashCollisionException : ModdingFrameworkException
44 | {
45 | public HashCollisionException()
46 | {
47 | }
48 |
49 | public HashCollisionException(string message)
50 | : base(message)
51 | {
52 | }
53 |
54 | public HashCollisionException(string message, Exception inner)
55 | : base(message, inner)
56 | {
57 | }
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/xivModdingFramework/General/DataContainers/SearchResults.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 |
19 | namespace xivModdingFramework.General.DataContainers
20 | {
21 | public class SearchResults : IComparable
22 | {
23 | ///
24 | /// The slot for the item
25 | ///
26 | public string Slot { get; set; }
27 |
28 | ///
29 | /// The body for the item
30 | ///
31 | public string Body { get; set; }
32 |
33 | ///
34 | /// The variant for the item
35 | ///
36 | public int Variant { get; set; }
37 |
38 | public int CompareTo(SearchResults results)
39 | {
40 | return Variant.CompareTo(results.Variant);
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/xivModdingFramework/General/Enums/XivCategory.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Globalization;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Resources;
6 | using xivModdingFramework.Resources;
7 |
8 | namespace xivModdingFramework.General.Enums
9 | {
10 | public static class XivCategories
11 | {
12 | static List _keys = null;
13 | static XivCategories()
14 | {
15 | _keys = typeof(XivStrings).GetProperties(BindingFlags.Static|BindingFlags.NonPublic).Select(it => it.Name).ToList();
16 | }
17 |
18 | public static string GetDisplayName(this string value)
19 | {
20 | var rm = new ResourceManager(typeof(XivStrings));
21 | string displayName = value;
22 | foreach(var key in _keys)
23 | {
24 | var name = rm.GetString(key,new CultureInfo("en"));
25 | if ( name== value)
26 | {
27 | displayName = rm.GetString(key);
28 | break;
29 | }
30 | }
31 | return displayName;
32 | }
33 | public static string GetEnDisplayName(this string value)
34 | {
35 | var rm = new ResourceManager(typeof(XivStrings));
36 | string displayName = value;
37 | foreach (var key in _keys)
38 | {
39 | var name = rm.GetString(key);
40 | if (name == value)
41 | {
42 | displayName = rm.GetString(key, new CultureInfo("en"));
43 | break;
44 | }
45 | }
46 | return displayName;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/xivModdingFramework/General/Enums/XivLanguage.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.ComponentModel;
19 | using System.Linq;
20 |
21 | namespace xivModdingFramework.General.Enums
22 | {
23 | ///
24 | /// Enum containing the languages supported by the game
25 | ///
26 | ///
27 | /// May need to be updated if the game ever supports an additional language
28 | ///
29 | public enum XivLanguage
30 | {
31 | [Description("en")] English,
32 | [Description("ja")] Japanese,
33 | [Description("de")] German,
34 | [Description("fr")] French,
35 | [Description("ko")] Korean,
36 | [Description("chs")] Chinese,
37 | [Description("none")] None
38 | }
39 |
40 | ///
41 | /// Class used to get the description from the enum value
42 | ///
43 | public static class XivLanguages
44 | {
45 | ///
46 | /// Gets the description from the enum value, in this case the Language
47 | ///
48 | /// The enum value
49 | /// The Language Code
50 | public static string GetLanguageCode(this XivLanguage value)
51 | {
52 | var field = value.GetType().GetField(value.ToString());
53 | var attribute = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), false);
54 | return attribute.Length > 0 ? attribute[0].Description : value.ToString();
55 | }
56 |
57 | ///
58 | /// Gets the enum value from the description
59 | ///
60 | /// The language string
61 | /// The XivLanguage enum
62 | public static XivLanguage GetXivLanguage(string value)
63 | {
64 | //esrinzou for china ffxiv
65 | if (value == "zh")
66 | return XivLanguage.Chinese;
67 | //esrinzou end
68 | var languages = Enum.GetValues(typeof(XivLanguage)).Cast();
69 |
70 | return languages.FirstOrDefault(language => language.GetLanguageCode() == value);
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/xivModdingFramework/General/GameInfo.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.IO;
19 | using xivModdingFramework.General.Enums;
20 |
21 | namespace xivModdingFramework
22 | {
23 | public class GameInfo
24 | {
25 | public const string GameVersionFileName = "ffxivgame.ver";
26 |
27 | ///
28 | /// The directory in which the game is installed.
29 | ///
30 | public DirectoryInfo GameDirectory { get; }
31 |
32 | ///
33 | /// The current version of the game.
34 | ///
35 | public Version GameVersion { get; }
36 |
37 | public string GameVersionFile { get
38 | {
39 | return GetGameVersionFile();
40 | }
41 | }
42 |
43 |
44 | ///
45 | /// The language used when parsing the game data.
46 | ///
47 | public XivLanguage GameLanguage { get; }
48 |
49 |
50 | ///
51 | /// Constructor for GameInfo
52 | ///
53 | /// The directory in which the game is installed.
54 | /// The language to use when parsing the game data.
55 | public GameInfo(DirectoryInfo gameDirectory, XivLanguage xivLanguage)
56 | {
57 | GameDirectory = gameDirectory;
58 | GameLanguage = xivLanguage;
59 | try
60 | {
61 | GameVersion = GetGameVersion();
62 | } catch
63 | {
64 | // Default. No version file is a non-critical bug.
65 | GameVersion = new Version("0.0.0.0");
66 | }
67 |
68 | if (!gameDirectory.FullName.Contains(Path.Combine("game", "sqpack", "ffxiv")))
69 | {
70 | throw new DirectoryNotFoundException("The given directory is incorrect.\n\nThe directory sould point to the \\game\\sqpack\\ffxiv folder");
71 | }
72 | }
73 |
74 | private string GetGameVersionFile()
75 | {
76 | try
77 | {
78 | var versionBasePath = GameDirectory.FullName.Substring(0, GameDirectory.FullName.IndexOf("sqpack", StringComparison.Ordinal));
79 | var versionFile = Path.Combine(versionBasePath, GameVersionFileName);
80 |
81 | if (!File.Exists(versionFile))
82 | {
83 | return null;
84 | }
85 |
86 | return versionFile;
87 | }
88 | catch
89 | {
90 | return null;
91 | }
92 |
93 | }
94 |
95 | public static Version ReadVersionFile(string file)
96 | {
97 | try
98 | {
99 | if (string.IsNullOrWhiteSpace(file) || !File.Exists(file))
100 | {
101 | return new Version();
102 | }
103 | var versionData = File.ReadAllLines(file);
104 | return new Version(versionData[0].Substring(0, versionData[0].LastIndexOf(".", StringComparison.Ordinal)));
105 | } catch {
106 | return new Version();
107 | }
108 | }
109 |
110 | ///
111 | /// Gets the games current version.
112 | ///
113 | /// The game version.
114 | private Version GetGameVersion()
115 | {
116 | try
117 | {
118 | var file = GetGameVersionFile();
119 | if (string.IsNullOrWhiteSpace(file))
120 | {
121 | return new Version();
122 | }
123 | return ReadVersionFile(file);
124 | }
125 | catch
126 | {
127 | return new Version();
128 | }
129 | }
130 | }
131 | }
--------------------------------------------------------------------------------
/xivModdingFramework/General/Quad.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | namespace xivModdingFramework.General
5 | {
6 | [Serializable]
7 | public struct Quad
8 | {
9 | public short[] Values;
10 |
11 | public Quad(long data)
12 | {
13 | Values = new short[4];
14 | Values[0] = (short)data;
15 | Values[1] = (short)(data >> 16);
16 | Values[2] = (short)(data >> 32);
17 | Values[3] = (short)(data >> 48);
18 | }
19 |
20 | public static Quad Read(byte[] buffer, int offset)
21 | {
22 | var data = BitConverter.ToInt64(buffer, offset);
23 | return new Quad(data);
24 | }
25 | public static Quad ReadBE(byte[] buffer, int offset)
26 | {
27 | // Assume endianness is reversed.
28 | var data = BitConverter.ToInt64(buffer.Reverse().ToArray(), offset);
29 | return new Quad(data);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/xivModdingFramework/General/XivModelChara.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using SixLabors.ImageSharp.Processing;
18 | using System.Collections.Generic;
19 | using System.IO;
20 | using System.Threading.Tasks;
21 | using xivModdingFramework.Cache;
22 | using xivModdingFramework.Exd.Enums;
23 | using xivModdingFramework.Exd.FileTypes;
24 | using xivModdingFramework.Helpers;
25 | using xivModdingFramework.Items.DataContainers;
26 | using xivModdingFramework.Items.Enums;
27 | using xivModdingFramework.Mods;
28 | using static xivModdingFramework.Exd.FileTypes.Ex;
29 |
30 | namespace xivModdingFramework.General
31 | {
32 | ///
33 | /// This class contains the methods to get data from modelchara exd
34 | ///
35 | public static class XivModelChara
36 | {
37 | ///
38 | /// Shortcut accessor for reading the modelchara Ex Data
39 | ///
40 | ///
41 | /// Dictionary with modelchara data
42 | public static async Task> GetModelCharaData(ModTransaction tx = null)
43 | {
44 | var ex = new Ex();
45 | var exData = await ex.ReadExData(XivEx.modelchara, tx);
46 | return exData;
47 | }
48 |
49 | ///
50 | /// Gets the model info from the modelchara exd file
51 | ///
52 | /// The game directory
53 | /// The index of the data
54 | /// The XivModelInfo data
55 | public static async Task GetModelInfo(int index, ModTransaction tx = null)
56 | {
57 | var ex = new Ex();
58 | var modelCharaEx = await ex.ReadExData(XivEx.modelchara, tx);
59 | return GetModelInfo(modelCharaEx[index]);
60 | }
61 |
62 | ///
63 | /// Gets the model info from the modelchara exd data
64 | ///
65 | /// The modelchara ex data
66 | /// The index of the data
67 | /// The XivModelInfo data
68 | public static XivModelInfo GetModelInfo(ExdRow row)
69 | {
70 | var xivModelInfo = new XivMonsterModelInfo();
71 |
72 | var type = (byte)row.GetColumnByName("Type");
73 | xivModelInfo.PrimaryID = (ushort) row.GetColumnByName("PrimaryId");
74 | xivModelInfo.SecondaryID = (byte)row.GetColumnByName("SecondaryId");
75 | xivModelInfo.ImcSubsetID = (byte)row.GetColumnByName("Variant");
76 |
77 | if (type == 2)
78 | {
79 | xivModelInfo.ModelType = XivItemType.demihuman;
80 | }
81 | else if (type == 3)
82 | {
83 | xivModelInfo.ModelType = XivItemType.monster;
84 | }
85 | else
86 | {
87 | xivModelInfo.ModelType = XivItemType.unknown;
88 | }
89 |
90 | return xivModelInfo;
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/xivModdingFramework/HUD/FileTypes/Uld.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.Collections.Generic;
19 | using System.Diagnostics;
20 | using System.IO;
21 | using System.Linq;
22 | using System.Text;
23 | using System.Threading.Tasks;
24 | using xivModdingFramework.General.Enums;
25 | using xivModdingFramework.Helpers;
26 | using xivModdingFramework.Mods;
27 | using xivModdingFramework.SqPack.FileTypes;
28 |
29 | using Index = xivModdingFramework.SqPack.FileTypes.Index;
30 |
31 | namespace xivModdingFramework.HUD.FileTypes
32 | {
33 | ///
34 | /// This class contains the methods that deal with the .uld file type
35 | ///
36 | public static class Uld
37 | {
38 | ///
39 | /// Gets the texture paths from the uld file
40 | ///
41 | /// List of texture paths from the uld file
42 | public static async Task> GetTexFromUld(ModTransaction tx = null)
43 | {
44 | var uldLock = new object();
45 | var hashedFolder = HashGenerator.GetHash("ui/uld");
46 |
47 | var uldStringList = new HashSet();
48 | var uldOffsetList = await Index.GetAllFileOffsetsInFolder(hashedFolder, XivDataFile._06_Ui, tx);
49 |
50 | var tasks = new List();
51 | foreach(var offset in uldOffsetList)
52 | {
53 | tasks.Add(Task.Run (async () =>
54 | {
55 | byte[] uldData;
56 | var type = await tx.GetSqPackType(XivDataFile._06_Ui, offset, false);
57 | if (type == 2)
58 | {
59 | uldData = await tx.ReadFile(XivDataFile._06_Ui, offset);
60 | }
61 | else
62 | {
63 | return;
64 | }
65 |
66 | if (uldData.Length < 10) return;
67 |
68 | using (var br = new BinaryReader(new MemoryStream(uldData)))
69 | {
70 | var signature = br.ReadInt32();
71 |
72 | if (signature != 1751411829) return;
73 |
74 | br.ReadBytes(56);
75 |
76 | int pathCount = br.ReadByte();
77 |
78 | br.ReadBytes(7);
79 |
80 | for (var i = 0; i < pathCount; i++)
81 | {
82 | var pathNum = br.ReadInt32();
83 | while (pathNum != i + 1)
84 | {
85 | pathNum = br.ReadInt32();
86 | }
87 |
88 | var path = Encoding.UTF8.GetString(br.ReadBytes(48)).Replace("\0", "");
89 | path = new string(path.Where(c => !char.IsControl(c)).ToArray());
90 |
91 | if (path.Length <= 2 || !path.Contains("uld")) continue;
92 |
93 | var uldPath = path.Substring(0, path.LastIndexOf(".", StringComparison.Ordinal) + 4);
94 |
95 | lock (uldLock)
96 | {
97 | uldStringList.Add(uldPath);
98 | }
99 | }
100 | }
101 | }));
102 | }
103 |
104 | await Task.WhenAll(tasks);
105 |
106 | return uldStringList.ToList();
107 | }
108 | }
109 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Helpers/BinaryReaderBE.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.IO;
19 |
20 | namespace xivModdingFramework.Helpers
21 | {
22 | ///
23 | /// This helper class is used to read files that are in Big Endian Byte Order
24 | ///
25 | public class BinaryReaderBE : BinaryReader
26 | {
27 | ///
28 | /// This helper class is used to read files that are in Big Endian Byte Order
29 | ///
30 | public BinaryReaderBE(Stream input) : base(input)
31 | {
32 | }
33 |
34 | public override short ReadInt16()
35 | {
36 | var bytes = ReadBytes(2);
37 | Array.Reverse(bytes);
38 | return BitConverter.ToInt16(bytes, 0);
39 | }
40 |
41 | public override ushort ReadUInt16()
42 | {
43 | var bytes = ReadBytes(2);
44 | Array.Reverse(bytes);
45 | return BitConverter.ToUInt16(bytes, 0);
46 | }
47 |
48 | public override int ReadInt32()
49 | {
50 | var bytes = ReadBytes(4);
51 | Array.Reverse(bytes);
52 | return BitConverter.ToInt32(bytes, 0);
53 | }
54 |
55 | public override uint ReadUInt32()
56 | {
57 | var bytes = ReadBytes(4);
58 | Array.Reverse(bytes);
59 | return BitConverter.ToUInt32(bytes, 0);
60 | }
61 |
62 | public override long ReadInt64()
63 | {
64 | var bytes = ReadBytes(8);
65 | Array.Reverse(bytes);
66 | return BitConverter.ToInt64(bytes, 0);
67 | }
68 |
69 | public override ulong ReadUInt64()
70 | {
71 | var bytes = ReadBytes(8);
72 | Array.Reverse(bytes);
73 | return BitConverter.ToUInt64(bytes, 0);
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Helpers/Constants.cs:
--------------------------------------------------------------------------------
1 | using HelixToolkit.SharpDX.Core;
2 | using HelixToolkit.SharpDX.Core.Model.Scene2D;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Text;
6 | using System.Text.RegularExpressions;
7 |
8 | namespace xivModdingFramework.Helpers
9 | {
10 | // I'm not sure why we didn't have a constants class to refer to before, but oh well.
11 | public static class Constants
12 | {
13 | ///
14 | /// The alphabet. Now in character array form.
15 | ///
16 | public static readonly char[] Alphabet = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
17 | public static string BinaryOffsetMarker = "::";
18 |
19 | public const string InternalModSourceName = "_INTERNAL_";
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/xivModdingFramework/Helpers/PenumbraAPI.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Linq;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Diagnostics;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Net.Http;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 |
12 | namespace xivModdingFramework.Helpers
13 | {
14 | ///
15 | /// Simple thin static class that handles poking the Penumbra HTTP API
16 | /// Most functions just return a boolean for success status.
17 | ///
18 | public static class PenumbraAPI
19 | {
20 |
21 | ///
22 | /// Calls /redraw on the Penumbra API.
23 | ///
24 | ///
25 | public static async Task Redraw()
26 | {
27 | return await Request("/redraw");
28 |
29 | }
30 |
31 | ///
32 | /// Calls /reloadmod on the Penumbra API.
33 | ///
34 | ///
35 | public static async Task ReloadMod(string path, string name = null)
36 | {
37 | Dictionary args = new Dictionary();
38 |
39 | if (name != null)
40 | {
41 | args.Add("Name", name);
42 | }
43 | if (path != null)
44 | {
45 | args.Add("Path", path);
46 | }
47 |
48 | return await Request("/reloadmod", args);
49 | }
50 |
51 | private static HttpClient _Client = new HttpClient() { BaseAddress = new System.Uri("http://localhost:42069") };
52 |
53 | private static async Task Request(string urlPath, object data = null)
54 | {
55 | data = data == null ? new object() : data;
56 | return await Task.Run(async () => {
57 | try
58 | {
59 | using StringContent jsonContent = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json");
60 | using HttpResponseMessage response = await _Client.PostAsync("api/" + urlPath, jsonContent);
61 |
62 | response.EnsureSuccessStatusCode();
63 |
64 | return true;
65 | }
66 | catch (Exception ex)
67 | {
68 | return false;
69 | //throw;
70 | }
71 | });
72 | }
73 |
74 |
75 | public static string GetQuickLauncherGameDirectory()
76 | {
77 | var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "XIVLauncher", "launcherConfigV3.json");
78 | if (!File.Exists(path))
79 | {
80 | return "";
81 | }
82 |
83 | try
84 | {
85 | var obj = JObject.Parse(File.ReadAllText(path));
86 | var st = (string)obj["GamePath"];
87 | return st;
88 | }
89 | catch (Exception ex)
90 | {
91 | return "";
92 | }
93 | }
94 |
95 | public static string GetPenumbraDirectory()
96 | {
97 | var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "XIVLauncher", "pluginConfigs", "Penumbra.json");
98 | if (!File.Exists(path))
99 | {
100 | return "";
101 | }
102 |
103 | try
104 | {
105 | var obj = JObject.Parse(File.ReadAllText(path));
106 | var st = (string)obj["ModDirectory"];
107 | return st;
108 | }
109 | catch (Exception ex)
110 | {
111 | return "";
112 | }
113 | }
114 |
115 | public static bool IsPenumbraInstalled()
116 | {
117 | var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "XIVLauncher", "dalamudConfig.json");
118 | if (!File.Exists(path))
119 | {
120 | return false;
121 | }
122 |
123 | try
124 | {
125 | var obj = JObject.Parse(File.ReadAllText(path));
126 | var profile = (JObject)obj["DefaultProfile"];
127 | var plugins = (JObject)profile["Plugins"];
128 | var pValues = (JArray)plugins["$values"];
129 |
130 | var penumbra = pValues.FirstOrDefault(x => (string)x["InternalName"] == "Penumbra");
131 |
132 | if(penumbra != null)
133 | {
134 | // Normally we'd stop here. But while Penumbra is in testing we need to check that part.
135 | var optIns = (JObject)obj["PluginTestingOptIns"];
136 | var oValues = (JArray)optIns["$values"];
137 | var pTesting = oValues.FirstOrDefault(x => (string)x["InternalName"] == "Penumbra");
138 | if ((string)pTesting["Branch"] == "testing-live")
139 | {
140 | return true;
141 | }
142 |
143 | return false;
144 | } else
145 | {
146 | return false;
147 | }
148 | }
149 | catch (Exception ex)
150 | {
151 | return false;
152 | }
153 | }
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/xivModdingFramework/Items/DataContainers/XivCharacter.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.Collections.Generic;
19 | using System.Linq;
20 | using System.Threading.Tasks;
21 | using xivModdingFramework.Cache;
22 | using xivModdingFramework.General.Enums;
23 | using xivModdingFramework.Items.Categories;
24 | using xivModdingFramework.Items.Interfaces;
25 | using xivModdingFramework.Models.FileTypes;
26 | using xivModdingFramework.Mods;
27 | using xivModdingFramework.Resources;
28 |
29 | namespace xivModdingFramework.Items.DataContainers
30 | {
31 | ///
32 | /// This class holds information for Items in the Character Category
33 | ///
34 | public class XivCharacter : IItemModel
35 | {
36 | ///
37 | /// The name of the character item
38 | ///
39 | public string Name { get; set; }
40 |
41 | ///
42 | /// The Main Category
43 | ///
44 | ///
45 | /// For character items, the category is "Character"
46 | ///
47 | public string PrimaryCategory { get; set; }
48 |
49 | ///
50 | /// The item Category
51 | ///
52 | ///
53 | /// This would be a category such as Hair, Face, Body, Tail
54 | ///
55 | public string SecondaryCategory { get; set; }
56 |
57 | ///
58 | /// The item SubCategory
59 | ///
60 | ///
61 | /// This is currently not used for the Character Category, but may be used in the future
62 | ///
63 | public string TertiaryCategory { get; set; }
64 |
65 | ///
66 | /// The data file the item belongs to
67 | ///
68 | ///
69 | /// Character items are always in 040000
70 | ///
71 | public XivDataFile DataFile { get; set; } = XivDataFile._04_Chara;
72 |
73 | public uint IconId { get; set; }
74 |
75 | ///
76 | /// The Primary Model Information of the Character Item
77 | ///
78 | public XivModelInfo ModelInfo { get; set; }
79 | internal static IItemModel FromDependencyRoot(XivDependencyRoot root)
80 | {
81 | var item = new XivCharacter();
82 | item.ModelInfo = new XivModelInfo();
83 | item.ModelInfo.PrimaryID = root.Info.PrimaryId;
84 | item.ModelInfo.SecondaryID = (int)root.Info.SecondaryId;
85 | item.PrimaryCategory = XivStrings.Character;
86 |
87 | if (root.Info.Slot != null)
88 | {
89 | item.SecondaryCategory = Mdl.SlotAbbreviationDictionary.FirstOrDefault(x => x.Value == root.Info.Slot).Key;
90 |
91 | //var race = XivRaces.GetXivRace(root.Info.PrimaryId.ToString().PadLeft(4, '0')).GetDisplayName();
92 | item.Name = item.SecondaryCategory + " - " + root.Info.GetBaseFileName();
93 | } else
94 | {
95 | item.Name = root.Info.GetBaseFileName();
96 | item.SecondaryCategory = XivStrings.Body;
97 | }
98 |
99 |
100 | return item;
101 | }
102 |
103 | public async Task> GetDecalTextures(ModTransaction tx = null)
104 | {
105 | if(tx == null)
106 | {
107 | // Readonly TX if we don't have one.
108 | tx = ModTransaction.BeginReadonlyTransaction();
109 | }
110 |
111 | if(SecondaryCategory == XivStrings.Face_Paint)
112 | {
113 | return await Character.GetDecalPaths(Character.XivDecalType.FacePaint, tx);
114 | }
115 | else if(SecondaryCategory == XivStrings.Equipment_Decals)
116 | {
117 | return await Character.GetDecalPaths(Character.XivDecalType.Equipment, tx);
118 | }
119 | else
120 | {
121 | return new List();
122 | }
123 | }
124 |
125 | ///
126 | /// Gets the item's name as it should be written to the modlist/modpack files.
127 | ///
128 | ///
129 | public string GetModlistItemName()
130 | {
131 | return SecondaryCategory != null ? SecondaryCategory : "Unknown";
132 | }
133 |
134 | ///
135 | /// Gets the item's category as it should be written to the modlist/modpack files.
136 | ///
137 | ///
138 | public string GetModlistItemCategory()
139 | {
140 | return XivStrings.Character;
141 | }
142 |
143 | public int CompareTo(object obj)
144 | {
145 | return string.Compare(Name, ((XivCharacter)obj).Name, StringComparison.Ordinal);
146 | }
147 | public object Clone()
148 | {
149 | var copy = (XivCharacter)this.MemberwiseClone();
150 | copy.ModelInfo = (XivModelInfo) ModelInfo?.Clone();
151 | return copy;
152 | }
153 | }
154 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Items/DataContainers/XivGenericItemModel.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using xivModdingFramework.Cache;
19 | using xivModdingFramework.General.Enums;
20 | using xivModdingFramework.Items.Interfaces;
21 | using xivModdingFramework.Resources;
22 |
23 | namespace xivModdingFramework.Items.DataContainers
24 | {
25 | ///
26 | /// This class holds information for Generic Items with models
27 | ///
28 | public class XivGenericItemModel : IItemModel
29 | {
30 | ///
31 | /// The name of the item
32 | ///
33 | public string Name { get; set; }
34 |
35 | ///
36 | /// The Main Category
37 | ///
38 | public string PrimaryCategory { get; set; }
39 |
40 | ///
41 | /// The item Category
42 | ///
43 | public string SecondaryCategory { get; set; }
44 |
45 | ///
46 | /// The item SubCategory
47 | ///
48 | public string TertiaryCategory { get; set; }
49 |
50 | ///
51 | /// The data file the item belongs to
52 | ///
53 | public XivDataFile DataFile { get; set; }
54 |
55 | ///
56 | /// The Model Information for the gear item
57 | ///
58 | public XivModelInfo ModelInfo { get; set; }
59 | public uint IconId { get; set; }
60 |
61 | ///
62 | /// Gets the item's name as it should be written to the modlist/modpack files.
63 | ///
64 | ///
65 | public string GetModlistItemName()
66 | {
67 | return Name != null ? Name : "Unknown Item";
68 | }
69 |
70 | ///
71 | /// Gets the item's category as it should be written to the modlist/modpack files.
72 | ///
73 | ///
74 | public string GetModlistItemCategory()
75 | {
76 | return SecondaryCategory != null ? SecondaryCategory : "Unknown";
77 | }
78 | internal static IItemModel FromDependencyRoot(XivDependencyRoot root, int imcSubset)
79 | {
80 | var item = new XivGenericItemModel();
81 | item.ModelInfo = new XivModelInfo();
82 | item.ModelInfo.ImcSubsetID = imcSubset;
83 | item.ModelInfo.PrimaryID = root.Info.PrimaryId;
84 | item.ModelInfo.SecondaryID = (int)root.Info.SecondaryId;
85 | item.Name = root.Info.GetBaseFileName() + "_v" + imcSubset.ToString();
86 | item.PrimaryCategory = XivStrings.Gear;
87 |
88 | return item;
89 | }
90 |
91 | public int CompareTo(object obj)
92 | {
93 | return string.Compare(Name, ((XivGenericItemModel)obj).Name, StringComparison.Ordinal);
94 | }
95 |
96 | public object Clone()
97 | {
98 | var copy = (XivGenericItemModel)this.MemberwiseClone();
99 | copy.ModelInfo = (XivModelInfo)ModelInfo.Clone();
100 | return copy;
101 | }
102 | }
103 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Items/DataContainers/XivMinion.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using xivModdingFramework.General.Enums;
19 | using xivModdingFramework.Items.Interfaces;
20 | using xivModdingFramework.Resources;
21 |
22 | namespace xivModdingFramework.Items.DataContainers
23 | {
24 | ///
25 | /// This class contains information for items in the Minion Category
26 | ///
27 | public class XivMinion : IItemModel
28 | {
29 | ///
30 | /// The name of the minion
31 | ///
32 | public string Name { get; set; }
33 |
34 | ///
35 | /// The Main Category
36 | ///
37 | ///
38 | /// For Minions the main category is "Companions"
39 | ///
40 | public string PrimaryCategory { get; set; }
41 |
42 | ///
43 | /// The item Category
44 | ///
45 | ///
46 | /// For minions the item category is "Minions"
47 | ///
48 | public string SecondaryCategory { get; set; }
49 |
50 | ///
51 | /// The item SubCategory
52 | ///
53 | ///
54 | /// This is currently not used for the Minion Category, but may be used in the future
55 | ///
56 | public string TertiaryCategory { get; set; }
57 |
58 | ///
59 | /// The data file the item belongs to
60 | ///
61 | ///
62 | /// Minion items are always in 040000
63 | ///
64 | public XivDataFile DataFile { get; set; } = XivDataFile._04_Chara;
65 |
66 | public uint IconId { get; set; }
67 |
68 | ///
69 | /// The Primary Model Information of the Minion Item
70 | ///
71 | public XivModelInfo ModelInfo { get; set; }
72 |
73 | ///
74 | /// Gets the item's name as it should be written to the modlist/modpack files.
75 | ///
76 | ///
77 | public string GetModlistItemName()
78 | {
79 | return Name != null ? Name : "Unknown Minion";
80 | }
81 |
82 | ///
83 | /// Gets the item's category as it should be written to the modlist/modpack files.
84 | ///
85 | ///
86 | public string GetModlistItemCategory()
87 | {
88 | return SecondaryCategory != null ? SecondaryCategory : XivStrings.Minions;
89 | }
90 | public int CompareTo(object obj)
91 | {
92 | return string.Compare(Name, ((XivMinion)obj).Name, StringComparison.Ordinal);
93 | }
94 |
95 | public object Clone()
96 | {
97 | var copy = (XivMinion)this.MemberwiseClone();
98 | copy.ModelInfo = (XivModelInfo)ModelInfo.Clone();
99 | return copy;
100 | }
101 | }
102 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Items/DataContainers/XivModelInfo.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using xivModdingFramework.General;
19 | using xivModdingFramework.Items.Enums;
20 |
21 | namespace xivModdingFramework.Items.DataContainers
22 | {
23 | ///
24 | /// This class contains Model Information for an Item
25 | /// Note - This is a partial class effectively, and
26 | /// cannot actually be resolved into a full model without
27 | /// it's parent IIitem, as it lacks a slot identifier (top, dwn, glv, ...)
28 | ///
29 | public class XivModelInfo : ICloneable
30 | {
31 |
32 | ///
33 | /// The Item's primary ID. This is one of:
34 | /// - (e)quipment number
35 | /// - (a)ccessory number
36 | /// - (w)eapon number
37 | /// - (d)emihuman number
38 | /// - (m)onster number
39 | /// - bg/furniture number
40 | /// - ui/icon number
41 | ///
42 | public int PrimaryID { get; set; }
43 |
44 | ///
45 | /// The Item's secondary ID. This is one of
46 | /// - (b)ody number (Monster/Companion/Weapon)
47 | /// - (e)quipment number (Demihuman)
48 | /// - (z)ear number (Human)
49 | /// - (f)ace number (Human)
50 | /// - (t)ail number (Human)
51 | /// - (h)air number (Human)
52 | /// - None
53 | ///
54 | public int SecondaryID { get; set; }
55 |
56 | ///
57 | /// The item's Model SubSet ID - This can be resolved to
58 | /// Material Set ID/Variant via use of IMC->GetImcInfo()
59 | /// Only available for equipment items.
60 | ///
61 | public int ImcSubsetID { get; set; }
62 |
63 | public object Clone()
64 | {
65 | return MemberwiseClone();
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Items/DataContainers/XivMonsterModelInfo.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using xivModdingFramework.General;
19 | using xivModdingFramework.Items.Enums;
20 |
21 | namespace xivModdingFramework.Items.DataContainers
22 | {
23 | ///
24 | /// This class contains Model Information for an Item
25 | /// Note - This is a partial class effectively, and
26 | /// cannot actually be resolved into a full model without
27 | /// it's parent IIitem, as it lacks a slot identifier (top, dwn, glv, ...)
28 | ///
29 | public class XivMonsterModelInfo: XivModelInfo
30 | {
31 |
32 | ///
33 | /// Model type as pulled from the ModelChara EXD.
34 | ///
35 | public XivItemType ModelType;
36 | }
37 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Items/DataContainers/XivMount.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.Linq;
19 | using xivModdingFramework.Cache;
20 | using xivModdingFramework.General.Enums;
21 | using xivModdingFramework.Items.Interfaces;
22 | using xivModdingFramework.Models.FileTypes;
23 | using xivModdingFramework.Resources;
24 |
25 | namespace xivModdingFramework.Items.DataContainers
26 | {
27 | ///
28 | /// This class holds information for items in the Mount Category
29 | ///
30 | public class XivMount : IItemModel
31 | {
32 | ///
33 | /// The mount name
34 | ///
35 | public string Name { get; set; }
36 |
37 | ///
38 | /// The Main Category
39 | ///
40 | ///
41 | /// For Mounts the Main Category is "Companions"
42 | ///
43 | public string PrimaryCategory { get; set; }
44 |
45 | ///
46 | /// The item Category
47 | ///
48 | ///
49 | /// For Mounts the item Category is "Mounts"
50 | ///
51 | public string SecondaryCategory { get; set; }
52 |
53 | ///
54 | /// The item SubCategory
55 | ///
56 | ///
57 | /// This is currently not used for the Mount Category, but may be used in the future
58 | ///
59 | public string TertiaryCategory { get; set; }
60 |
61 | public uint IconId { get; set; }
62 |
63 | ///
64 | /// The data file the item belongs to
65 | ///
66 | ///
67 | /// Mount items are always in 040000
68 | ///
69 | public XivDataFile DataFile { get; set; } = XivDataFile._04_Chara;
70 |
71 | ///
72 | /// The Primary Model Information of the Mount Item
73 | ///
74 | public XivModelInfo ModelInfo { get; set; }
75 |
76 | ///
77 | /// Gets the item's name as it should be written to the modlist/modpack files.
78 | ///
79 | ///
80 | public string GetModlistItemName()
81 | {
82 | return Name != null ? Name : "Unknown Mount";
83 | }
84 |
85 | ///
86 | /// Gets the item's category as it should be written to the modlist/modpack files.
87 | ///
88 | ///
89 | public string GetModlistItemCategory()
90 | {
91 | return SecondaryCategory != null ? SecondaryCategory : XivStrings.Mounts;
92 | }
93 | internal static IItemModel FromDependencyRoot(XivDependencyRoot root, int imcSubset)
94 | {
95 | var item = new XivMount();
96 | var mi = new XivMonsterModelInfo();
97 | mi.ModelType = root.Info.PrimaryType;
98 | mi.PrimaryID = root.Info.PrimaryId;
99 | mi.SecondaryID = (int)root.Info.SecondaryId;
100 | mi.ImcSubsetID = imcSubset;
101 |
102 | item.ModelInfo = mi;
103 | item.Name = root.Info.GetBaseFileName() + "_v" + imcSubset.ToString();
104 | item.PrimaryCategory = XivStrings.Companions;
105 | item.SecondaryCategory = XivStrings.Mounts;
106 |
107 | if(root.Info.Slot != null)
108 | {
109 | item.TertiaryCategory = Mdl.SlotAbbreviationDictionary.First(x => x.Value == root.Info.Slot).Key;
110 | }
111 |
112 | return item;
113 | }
114 |
115 | public int CompareTo(object obj)
116 | {
117 | return string.Compare(Name, ((XivMount)obj).Name, StringComparison.Ordinal);
118 | }
119 |
120 | public object Clone()
121 | {
122 | var copy = (XivMount)this.MemberwiseClone();
123 | copy.ModelInfo = (XivModelInfo)ModelInfo.Clone();
124 | return copy;
125 | }
126 | }
127 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Items/DataContainers/XivPet.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using xivModdingFramework.General.Enums;
19 | using xivModdingFramework.Items.Interfaces;
20 | using xivModdingFramework.Resources;
21 |
22 | namespace xivModdingFramework.Items.DataContainers
23 | {
24 | ///
25 | /// This class contains information for Items in the Pet Category
26 | ///
27 | public class XivPet : IItemModel
28 | {
29 | ///
30 | /// The name of the Pet
31 | ///
32 | public string Name { get; set; }
33 |
34 | ///
35 | /// The Main Category
36 | ///
37 | ///
38 | /// For Pets the Main Category is "Companions"
39 | ///
40 | public string PrimaryCategory { get; set; }
41 |
42 | ///
43 | /// The item category
44 | ///
45 | ///
46 | /// For Pets the item Category is "Pets"
47 | ///
48 | public string SecondaryCategory { get; set; }
49 |
50 | ///
51 | /// The item SubCategory
52 | ///
53 | ///
54 | /// This is currently not used for the Pet Category, but may be used in the future
55 | ///
56 | public string TertiaryCategory { get; set; }
57 | public uint IconId { get; set; }
58 |
59 | ///
60 | /// The data file the item belongs to
61 | ///
62 | ///
63 | /// Mount items are always in 040000
64 | ///
65 | public XivDataFile DataFile { get; set; } = XivDataFile._04_Chara;
66 |
67 | ///
68 | /// The Primary Model Information of the Pet Item
69 | ///
70 | public XivModelInfo ModelInfo { get; set; }
71 |
72 | ///
73 | /// Gets the item's name as it should be written to the modlist/modpack files.
74 | ///
75 | ///
76 | public string GetModlistItemName()
77 | {
78 | return Name != null ? Name : "Unknown Pet";
79 | }
80 |
81 | ///
82 | /// Gets the item's category as it should be written to the modlist/modpack files.
83 | ///
84 | ///
85 | public string GetModlistItemCategory()
86 | {
87 | return SecondaryCategory != null ? SecondaryCategory : XivStrings.Pets;
88 | }
89 | public int CompareTo(object obj)
90 | {
91 | return string.Compare(Name, ((XivPet)obj).Name, StringComparison.Ordinal);
92 | }
93 |
94 | public object Clone()
95 | {
96 | var copy = (XivPet)this.MemberwiseClone();
97 | copy.ModelInfo = (XivModelInfo)ModelInfo.Clone();
98 | return copy;
99 | }
100 | }
101 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Items/Interfaces/IItem.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using HelixToolkit.SharpDX.Core.Utilities.ImagePacker;
18 | using System;
19 | using System.Collections.Generic;
20 | using xivModdingFramework.General.Enums;
21 |
22 | namespace xivModdingFramework.Items.Interfaces
23 | {
24 | ///
25 | /// Interface for Item details
26 | ///
27 | public interface IItem : IComparable
28 | {
29 | ///
30 | /// The item Name
31 | ///
32 | string Name { get; set; }
33 |
34 | ///
35 | /// The top level category
36 | /// -- This has no relevance in actual game file structure. This is purely a
37 | /// -- custom generated Human Readable convention for the sake of TexTools sorting.
38 | ///
39 | ///
40 | /// This would be a category such as Gear, Character, Companion, and UI
41 | ///
42 | string PrimaryCategory { get; set; }
43 |
44 | ///
45 | /// The second level category.
46 | ///
47 | ///
48 | /// This would be a category such as Body, Legs, Ears, Hair, Minions, Maps
49 | ///
50 | string SecondaryCategory { get; set; }
51 |
52 | ///
53 | /// The third level category.
54 | ///
55 | ///
56 | /// This would be a category such as La Noscea within Maps, Marker within Actions, Detrimental within Status
57 | /// This is mostly used in the UI main category
58 | ///
59 | string TertiaryCategory { get; }
60 |
61 | ///
62 | /// The data file the item belongs to
63 | ///
64 | ///
65 | /// This would change depending on the data file the data is to be pulled from
66 | ///
67 | XivDataFile DataFile { get; }
68 |
69 | ///
70 | /// Gets the item's name as it should be written to the modlist/modpack files.
71 | ///
72 | ///
73 | public string GetModlistItemName();
74 |
75 | ///
76 | /// Gets the item's category as it should be written to the modlist/modpack files.
77 | ///
78 | ///
79 | public string GetModlistItemCategory();
80 | }
81 |
82 | ///
83 | /// Simple shell IItem that can be used as a filler when writing mods.
84 | ///
85 | public class SimpleIItem : IItem
86 | {
87 | public string Name { get; set; } = "";
88 |
89 | public string PrimaryCategory { get; set; } = "";
90 |
91 | public string SecondaryCategory { get; set; } = "";
92 |
93 | public string TertiaryCategory { get; set; } = "";
94 |
95 | public XivDataFile DataFile => XivDataFile._04_Chara;
96 | public SimpleIItem(string name, string category)
97 | {
98 | Name = name;
99 | SecondaryCategory = category;
100 | }
101 |
102 | public int CompareTo(object obj)
103 | {
104 | return 0;
105 | }
106 |
107 | public string GetModlistItemName()
108 | {
109 | return Name;
110 | }
111 |
112 | public string GetModlistItemCategory()
113 | {
114 | return SecondaryCategory;
115 | }
116 | }
117 |
118 |
119 | ///
120 | /// Custom item name comparator.
121 | /// [Human Readable Names] => [NPC Names] => [Nulls/Invalids]
122 | ///
123 | public class ItemNameComparer : IComparer
124 | {
125 | public ItemNameComparer()
126 | {
127 | }
128 |
129 | public int Compare(string x, string y)
130 | {
131 | // Nulls
132 | var xNull = String.IsNullOrEmpty(x);
133 | var yNull = String.IsNullOrEmpty(y);
134 | if ( xNull && yNull )
135 | {
136 | return 0;
137 | } else if(xNull)
138 | {
139 | return 1;
140 | } else if(yNull)
141 | {
142 | return -1;
143 | }
144 |
145 | // Both NPC Items.
146 | var xNpc = x.Contains("_v");
147 | var yNpc = y.Contains("_v");
148 | if (xNpc && yNpc)
149 | {
150 | return String.Compare(x, y, StringComparison.InvariantCultureIgnoreCase);
151 | } else if(xNpc)
152 | {
153 | return 1;
154 | } else if (yNpc)
155 | {
156 | return -1;
157 | }
158 |
159 |
160 | return String.Compare(x, y, StringComparison.InvariantCultureIgnoreCase);
161 | }
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/xivModdingFramework/Items/Interfaces/IItemModel.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.IO;
19 | using System.Threading.Tasks;
20 | using xivModdingFramework.Cache;
21 | using xivModdingFramework.General.Enums;
22 | using xivModdingFramework.Helpers;
23 | using xivModdingFramework.Items.DataContainers;
24 | using xivModdingFramework.Resources;
25 |
26 | namespace xivModdingFramework.Items.Interfaces
27 | {
28 | ///
29 | /// Interface for Items that have model data
30 | ///
31 | public interface IItemModel : IItem, ICloneable
32 | {
33 | ///
34 | /// The Primary Model Information of the Item
35 | ///
36 | public XivModelInfo ModelInfo { get; set; }
37 |
38 | public uint IconId { get; set; }
39 | }
40 |
41 | public class SimpleItemModel : IItemModel, ICloneable
42 | {
43 | public SimpleItemModel(string path) : base() {
44 | ModelPath = path;
45 | ModelInfo = new XivModelInfo();
46 | }
47 |
48 | public XivModelInfo ModelInfo { get; set; }
49 | public uint IconId { get; set; }
50 | public string Name
51 | {
52 | get
53 | {
54 | if (string.IsNullOrWhiteSpace(ModelPath))
55 | {
56 | return "Unknown";
57 |
58 | }
59 | return Path.GetFileName(ModelPath);
60 | }
61 | set
62 | {
63 | // No-Op.
64 | }
65 | }
66 | public string PrimaryCategory { get; set; } = "Unknown";
67 | public string SecondaryCategory
68 | {
69 | get
70 | {
71 | if (string.IsNullOrWhiteSpace(ModelPath))
72 | {
73 | return "Unknown";
74 |
75 | }
76 | return Path.GetFileName(ModelPath);
77 | }
78 | set
79 | {
80 | // No-Op.
81 | }
82 | }
83 | public string TertiaryCategory { get; set; }
84 | public XivDataFile DataFile {
85 | get {
86 | return IOUtil.GetDataFileFromPath(ModelPath);
87 | }
88 | }
89 |
90 |
91 | public string ModelPath { get; set; }
92 |
93 | public object Clone()
94 | {
95 | var im = (SimpleItemModel)MemberwiseClone();
96 | im.ModelInfo = (XivModelInfo) ModelInfo.Clone();
97 | return im;
98 | }
99 |
100 | public int CompareTo(object obj)
101 | {
102 | var sm = obj as SimpleItemModel;
103 | if (sm == null) return -1;
104 | return ModelPath.CompareTo(sm.ModelPath);
105 | }
106 |
107 | public string GetModlistItemCategory()
108 | {
109 | return PrimaryCategory;
110 | }
111 |
112 | public string GetModlistItemName()
113 | {
114 | return SecondaryCategory;
115 | }
116 | }
117 |
118 | public static class IItemModelExtensions
119 | {
120 | public static bool HasRealModel(this IItemModel item)
121 | {
122 | // Catch for paintings being dumb.
123 | if(item.ModelInfo != null && item.SecondaryCategory != XivStrings.Paintings)
124 | {
125 | return true;
126 | }
127 | return false;
128 | }
129 | }
130 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/AttributeDataBlock.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System.Collections.Generic;
18 |
19 | namespace xivModdingFramework.Models.DataContainers
20 | {
21 | public class AttributeDataBlock
22 | {
23 | ///
24 | /// This data block contains the offsets to each attribute path within the data block
25 | ///
26 | ///
27 | /// The data block consists of offsets with an int data type (4 bytes each)
28 | ///
29 | public List AttributePathOffsetList { get; set; }
30 | }
31 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/BoneDataBlock.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System.Collections.Generic;
18 |
19 | namespace xivModdingFramework.Models.DataContainers
20 | {
21 | public class BoneDataBlock
22 | {
23 | ///
24 | /// This data block contains the offsets to each bone path within the data block
25 | ///
26 | ///
27 | /// The data block consists of offsets with an int data type (4 bytes each)
28 | ///
29 | public List BonePathOffsetList { get; set; }
30 | }
31 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/BoneIndexMesh.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System.Collections.Generic;
18 |
19 | namespace xivModdingFramework.Models.DataContainers
20 | {
21 | ///
22 | /// This class contains the properties of the Bone Index Data
23 | ///
24 | ///
25 | /// This references the specific bones that are used by the mesh by their index in the bone string list
26 | ///
27 | public class BoneSet
28 | {
29 | ///
30 | /// The list of Bone Indices
31 | ///
32 | ///
33 | /// This list contains the indices to the bones in MdlPathData.BoneList
34 | ///
35 | public List BoneIndices { get; set; }
36 |
37 | ///
38 | /// The number of indices in the Bone Index Data
39 | ///
40 | public int BoneIndexCount { get; set; }
41 | }
42 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/BoneTransformData.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using SharpDX;
18 |
19 | namespace xivModdingFramework.Models.DataContainers
20 | {
21 | ///
22 | /// Data for some sort of transform on bones
23 | ///
24 | ///
25 | /// The number of transforms is [ Bone Count ]
26 | ///
27 | public class BoneTransformData
28 | {
29 | ///
30 | /// The first Transform value
31 | ///
32 | public Vector4 Transform0 { get; set; }
33 |
34 | ///
35 | /// The second transform value
36 | ///
37 | public Vector4 Transform1 { get; set; }
38 |
39 | }
40 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/BoundingBox.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using SharpDX;
18 | using System.Collections.Generic;
19 |
20 | namespace xivModdingFramework.Models.DataContainers
21 | {
22 | ///
23 | /// This class contains the properties for the Bounding Box of the model
24 | ///
25 | public class BoundingBox
26 | {
27 | ///
28 | /// The list of point floats used by the bounding box
29 | ///
30 | public List PointList { get; set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/ColladaData.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System.Collections.Generic;
18 |
19 | namespace xivModdingFramework.Models.DataContainers
20 | {
21 | public class ColladaData
22 | {
23 | ///
24 | /// The bone strings as they appear in the collada file
25 | ///
26 | public string[] Bones { get; set; }
27 |
28 | ///
29 | /// The list of bones and their associated number
30 | ///
31 | public Dictionary BoneNumDictionary { get; set; } = new Dictionary();
32 |
33 | ///
34 | /// The bone names for the mesh
35 | ///
36 | public List MeshBoneNames { get; set; } = new List();
37 |
38 | ///
39 | /// The Vertex Positions
40 | ///
41 | public List Positions { get; set; } = new List();
42 |
43 | ///
44 | /// The Vertex Normals
45 | ///
46 | public List Normals { get; set; } = new List();
47 |
48 | ///
49 | /// The Vertex Colors
50 | ///
51 | public List VertexColors { get; set; } = new List();
52 |
53 | ///
54 | /// The Vertex Primary Texture Coordinates
55 | ///
56 | public List TextureCoordinates0 { get; set; } = new List();
57 |
58 | ///
59 | /// The Vertex Secondary Texture Coordinates
60 | ///
61 | public List TextureCoordinates1 { get; set; } = new List();
62 |
63 | ///
64 | /// The Vertex Alphas
65 | ///
66 | public List VertexAlphas { get; set; } = new List();
67 |
68 | ///
69 | /// The Vertex Bone Weights
70 | ///
71 | public List BoneWeights { get; set; } = new List();
72 |
73 | ///
74 | /// The Vertex BiNormals
75 | ///
76 | public List BiNormals { get; set; } = new List();
77 |
78 | ///
79 | /// The Vertex Tangents
80 | ///
81 | public List Tangents { get; set; } = new List();
82 |
83 | ///
84 | /// The Indices
85 | ///
86 | public List Indices { get; set; } = new List();
87 |
88 | ///
89 | /// Dictionary containing the location of vertex type indices
90 | ///
91 | public Dictionary IndexLocDictionary { get; set; }
92 |
93 | ///
94 | /// The Vertex Bone Indices
95 | ///
96 | public List BoneIndices { get; set; } = new List();
97 |
98 | ///
99 | /// The V count
100 | ///
101 | ///
102 | /// This list contains the number of bone weights per vertex
103 | ///
104 | public List Vcounts { get; set; } = new List();
105 |
106 | ///
107 | /// THe Position Indices
108 | ///
109 | public List PositionIndices { get; set; } = new List();
110 |
111 | ///
112 | /// The Normal Indices
113 | ///
114 | public List NormalIndices { get; set; } = new List();
115 |
116 | ///
117 | /// The BiNormal Indices
118 | ///
119 | public List BiNormalIndices { get; set; } = new List();
120 |
121 | ///
122 | /// The Primary Texture Coordinate Indices
123 | ///
124 | public List TextureCoordinate0Indices { get; set; } = new List();
125 |
126 | ///
127 | /// The Secondary Texture Coordinate Indices
128 | ///
129 | public List TextureCoordinate1Indices { get; set; } = new List();
130 |
131 | ///
132 | /// The Secondary Texture Coordinate Indices
133 | ///
134 | public List VertexColorIndices { get; set; } = new List();
135 |
136 | ///
137 | /// The Secondary Texture Coordinate Indices
138 | ///
139 | public List VertexAlphaIndices { get; set; } = new List();
140 |
141 | ///
142 | /// The Parts Dictionary
143 | ///
144 | public Dictionary PartsDictionary = new Dictionary();
145 |
146 | ///
147 | /// The stride for Index values
148 | ///
149 | public int IndexStride { get; set; }
150 |
151 | ///
152 | /// The stride for Texture Coordinate values
153 | ///
154 | public int TextureCoordinateStride { get; set; }
155 |
156 | ///
157 | /// The stride for Vertex Color values
158 | ///
159 | public int VertexColorStride { get; set; }
160 |
161 | ///
162 | /// A flag to determine if the import is from Blender
163 | ///
164 | public bool IsBlender { get; set; }
165 | }
166 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/EModelingTool.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace xivModdingFramework.Models.DataContainers
6 | {
7 | public enum EModelingTool
8 | {
9 | Blender,
10 | Max,
11 | Maya,
12 | Unreal,
13 | Unity,
14 | };
15 |
16 | public static class ModelingToolExtensions
17 | {
18 | public static bool UsesDirectXNormals(this EModelingTool modelingTool)
19 | {
20 | if(modelingTool == EModelingTool.Max || modelingTool == EModelingTool.Unreal)
21 | {
22 | return true;
23 | }
24 | return false;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/ExtraSkeletonEntry.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using xivModdingFramework.General.Enums;
5 | using xivModdingFramework.Helpers;
6 |
7 | namespace xivModdingFramework.Models.DataContainers
8 | {
9 | ///
10 | /// Class Representing a Extra Skeletons Table Entry for a Equipment Set.
11 | ///
12 | public class ExtraSkeletonEntry
13 | {
14 |
15 | public ExtraSkeletonEntry(XivRace race, ushort setId)
16 | {
17 | Race = race;
18 | SetId = setId;
19 | SkelId = 0;
20 | }
21 | public ExtraSkeletonEntry(XivRace race, ushort setId, ushort skelId)
22 | {
23 | SetId = setId;
24 | Race = race;
25 | SkelId = skelId;
26 | }
27 |
28 | public static void Write(byte[] data, ExtraSkeletonEntry entry, int count, int index)
29 | {
30 | int offset = (int)(4 + (index * 4));
31 | short raceId = Int16.Parse(XivRaces.GetRaceCode(entry.Race));
32 | IOUtil.ReplaceBytesAt(data, BitConverter.GetBytes(entry.SetId), offset);
33 | IOUtil.ReplaceBytesAt(data, BitConverter.GetBytes(raceId), offset + 2);
34 |
35 | var baseOffset = 4 + (count * 4);
36 | offset = (int)(baseOffset + (index * 2));
37 | IOUtil.ReplaceBytesAt(data, BitConverter.GetBytes(entry.SkelId), offset);
38 | }
39 | public static ExtraSkeletonEntry Read(byte[] data, uint count, uint index)
40 | {
41 |
42 | int offset = (int)(4 + (index * 4));
43 |
44 | var setId = BitConverter.ToUInt16(data, offset);
45 | var raceId = BitConverter.ToUInt16(data, offset + 2);
46 | var race = XivRaces.GetXivRace(raceId.ToString().PadLeft(4, '0'));
47 |
48 |
49 | var baseOffset = 4 + (count * 4);
50 | offset = (int)(baseOffset + (index * 2));
51 |
52 | var skelId = BitConverter.ToUInt16(data, offset);
53 |
54 | var ret = new ExtraSkeletonEntry(race, setId, skelId);
55 | return ret;
56 | }
57 |
58 | public ushort SetId;
59 | public XivRace Race;
60 | public ushort SkelId;
61 |
62 |
63 |
64 |
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/LevelOfDetail.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.Collections.Generic;
19 | using System.Linq;
20 | using xivModdingFramework.Materials.DataContainers;
21 |
22 | namespace xivModdingFramework.Models.DataContainers
23 | {
24 | ///
25 | /// This class contains properties for the Level of Detail data
26 | ///
27 | public class LevelOfDetail
28 | {
29 | public int TotalMeshCount
30 | {
31 | get
32 | {
33 | return MeshTypes.Sum(x => x.Key == EMeshType.TerrainShadow ? 0 : x.Value.Count);
34 | }
35 | }
36 |
37 | public bool HasExtraMeshes
38 | {
39 | get {
40 | var extraStart = (int)EMeshType.LightShaft;
41 | var extraMeshCount = 10;
42 |
43 | for(int i = extraStart; i < extraStart + extraMeshCount; i++)
44 | {
45 | var e = (EMeshType)i;
46 | if (MeshTypes.ContainsKey(e))
47 | {
48 | if (MeshTypes[e].Count > 0)
49 | {
50 | return true;
51 | }
52 | }
53 | }
54 | return false;
55 | }
56 | }
57 |
58 | public EMeshType GetMeshType(int offset)
59 | {
60 | foreach (var kv in MeshTypes)
61 | {
62 | if (offset >= kv.Value.Offset && offset < kv.Value.Offset + kv.Value.Count)
63 | {
64 | return kv.Key;
65 | }
66 | }
67 | throw new Exception("Unknown Mesh Type.");
68 |
69 | }
70 |
71 | public Dictionary MeshTypes = new Dictionary();
72 |
73 | ///
74 | /// Unknown Usage
75 | ///
76 | public float ModelLoDRange { get; set; }
77 |
78 | ///
79 | /// Unknown Usage
80 | ///
81 | public float TextureLoDRange { get; set; }
82 |
83 | ///
84 | /// Unknown Usage
85 | ///
86 | public int EdgeGeometrySize { get; set; }
87 |
88 | ///
89 | /// The offset at which the index data begins
90 | ///
91 | public int EdgeGeometryOffset { get; set; }
92 |
93 | ///
94 | /// Unknown Usage
95 | ///
96 | public int Unknown6 { get; set; }
97 |
98 | ///
99 | /// Unknown Usage
100 | /// This appears to be multiple individual byte values, with the first 2 being related to neck morph data
101 | ///
102 | public int Unknown7 { get; set; }
103 |
104 | ///
105 | /// The size of the Vertex Data Block
106 | ///
107 | public int VertexDataSize { get; set; }
108 |
109 | ///
110 | /// The size of the Index Data Block
111 | ///
112 | public int IndexDataSize { get; set; }
113 |
114 | ///
115 | /// The offset to the Vertex Data Block
116 | ///
117 | public int VertexDataOffset { get; set; }
118 |
119 | ///
120 | /// The offset to the Index Data Block
121 | ///
122 | public int IndexDataOffset { get; set; }
123 |
124 | ///
125 | /// The list of MeshData for the LoD
126 | ///
127 | public List MeshDataList { get; set; }
128 | }
129 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/MaterialDataBlock.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System.Collections.Generic;
18 |
19 | namespace xivModdingFramework.Models.DataContainers
20 | {
21 | public class MaterialDataBlock
22 | {
23 | ///
24 | /// This data block contains the offsets to each material path within the data block
25 | ///
26 | ///
27 | /// The data block consists of offsets with an int data type (4 bytes each)
28 | ///
29 | public List MaterialPathOffsetList { get; set; }
30 | }
31 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/MdlPathData.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System.Collections.Generic;
18 |
19 | namespace xivModdingFramework.Models.DataContainers
20 | {
21 | ///
22 | /// This class contains the properties for the MDL files path data
23 | ///
24 | public class MdlPathData
25 | {
26 | ///
27 | /// The number of paths contained in the Path Data Block
28 | ///
29 | public int PathCount { get; set; }
30 |
31 | ///
32 | /// The size of the Path Data Block
33 | ///
34 | public int PathBlockSize { get; set; }
35 |
36 | ///
37 | /// The list of attribute strings
38 | ///
39 | ///
40 | /// These will usually begin with 'atr_'
41 | ///
42 | public List AttributeList { get; set; }
43 |
44 | ///
45 | /// The list of bone strings
46 | ///
47 | ///
48 | /// These will usually begin with 'j_'
49 | ///
50 | public List BoneList { get; set; }
51 |
52 | ///
53 | /// The list of material strings
54 | ///
55 | ///
56 | /// These are references to the MTRL files used by the model
57 | ///
58 | public List MaterialList { get; set; }
59 |
60 | ///
61 | /// The list of shape strings
62 | ///
63 | ///
64 | /// These will usually begin with shp_
65 | ///
66 | public List ShapeList { get; set; }
67 |
68 | ///
69 | /// The list of extra path strings
70 | ///
71 | ///
72 | /// These are extra paths contained in the mdl path data
73 | ///
74 | public List ExtraPathList { get; set; }
75 | }
76 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/MeshData.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using SharpDX;
18 | using System.Collections.Generic;
19 |
20 | namespace xivModdingFramework.Models.DataContainers
21 | {
22 | public class MeshData
23 | {
24 | public int VertexBoneArraySize { get; set; }
25 |
26 | ///
27 | /// The information for the mesh data
28 | ///
29 | public MeshDataInfo MeshInfo { get; set; }
30 |
31 | ///
32 | /// The list of parts for the mesh
33 | ///
34 | public List MeshPartList { get; set; }
35 |
36 | ///
37 | /// The list of vertex data structures for the mesh
38 | ///
39 | public List VertexDataStructList { get; set; }
40 |
41 | ///
42 | /// The vertex data for the mesh
43 | ///
44 | public VertexData VertexData { get; set; }
45 |
46 | ///
47 | /// Determines whether this mesh contains a body material
48 | ///
49 | public bool IsBody { get; set; }
50 |
51 |
52 | ///
53 | /// A list of the shape paths associated with this mesh
54 | ///
55 | public List ShapePathList { get; set; }
56 | }
57 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/MeshDataInfo.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | namespace xivModdingFramework.Models.DataContainers
18 | {
19 | ///
20 | /// This class contains the properties of the Mesh Data Information
21 | ///
22 | public class MeshDataInfo
23 | {
24 | ///
25 | /// The number of vertices the mesh contains
26 | ///
27 | public int VertexCount { get; set; }
28 |
29 | ///
30 | /// The number of indcies the mesh contains
31 | ///
32 | public int IndexCount { get; set; }
33 |
34 | ///
35 | /// The index of the material used by the mesh
36 | ///
37 | ///
38 | /// This is the index of the material in the MaterialList from MdlPathData
39 | ///
40 | public short MaterialIndex { get; set; }
41 |
42 | ///
43 | /// The index of the Mesh Part to start at
44 | ///
45 | public short MeshPartIndex { get; set; }
46 |
47 | ///
48 | /// The number of Parts the mesh contains
49 | ///
50 | public short MeshPartCount { get; set; }
51 |
52 | ///
53 | /// The index of the Bone List to use for the mesh
54 | ///
55 | ///
56 | /// This is the index of the bone list in the BoneDataList
57 | ///
58 | public short BoneSetIndex { get; set; }
59 |
60 | ///
61 | /// The offset to the Index Data Block
62 | ///
63 | public int IndexDataOffset { get; set; }
64 |
65 | ///
66 | /// The offset to the first Vertex Data Block
67 | ///
68 | public int VertexDataOffset0 { get; set; }
69 |
70 | ///
71 | /// The offset to the second Vertex Data Block
72 | ///
73 | public int VertexDataOffset1 { get; set; }
74 |
75 | ///
76 | /// The offset to the Third Vertex Data Block
77 | ///
78 | ///
79 | /// This value is usually blank
80 | ///
81 | public int VertexDataOffset2 { get; set; }
82 |
83 | ///
84 | /// The size of each individual Vertex Data Entry in the first Vertex Data Block
85 | ///
86 | public byte VertexDataEntrySize0 { get; set; }
87 |
88 | ///
89 | /// The size of each individual Vertex Data Entry in the second Vertex Data Block
90 | ///
91 | public byte VertexDataEntrySize1 { get; set; }
92 |
93 | ///
94 | /// The size of each individual Vertex Data Entry in the third Vertex Data Block
95 | ///
96 | ///
97 | /// This value is usually blank
98 | ///
99 | public byte VertexDataEntrySize2 { get; set; }
100 |
101 | ///
102 | /// The number of vertex data blocks for the mesh
103 | ///
104 | public byte VertexStreamCountUnknown { get; set; }
105 | }
106 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/MeshPart.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | namespace xivModdingFramework.Models.DataContainers
18 | {
19 | ///
20 | /// This class contins the properties for the Parts for a Mesh
21 | ///
22 | public class MeshPart
23 | {
24 | ///
25 | /// The offset to the start index in the Index Data Block
26 | ///
27 | public int IndexOffset { get; set; }
28 |
29 | ///
30 | /// The number of indices the mesh part contains
31 | ///
32 | public int IndexCount { get; set; }
33 |
34 | ///
35 | /// The index to the attribute used by the mesh part
36 | ///
37 | ///
38 | /// This is the index to the value in MdlPathData.AttributeList
39 | ///
40 | public uint AttributeBitmask { get; set; }
41 |
42 | ///
43 | /// The offset to the starting bone in the BoneList
44 | ///
45 | public short BoneStartOffset { get; set; }
46 |
47 | ///
48 | /// The number of bones to use from the bone list beginning at the BoneStartOffset
49 | ///
50 | public short BoneCount { get; set; }
51 | }
52 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/ModelTextureData.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using xivModdingFramework.Helpers;
18 | using xivModdingFramework.Materials.DataContainers;
19 | using xivModdingFramework.Materials.FileTypes;
20 | using xivModdingFramework.Models.Helpers;
21 |
22 | namespace xivModdingFramework.Models.DataContainers
23 | {
24 | ///
25 | /// This class holds the data for the textures to be used on the 3D Model
26 | ///
27 | public class ModelTextureData
28 | {
29 | public int Width { get; set; }
30 |
31 | public int Height { get; set; }
32 |
33 |
34 | //Color Data
35 | public byte[] Diffuse { get; set; }
36 | public byte[] Specular { get; set; }
37 | public byte[] Emissive { get; set; }
38 |
39 | // Other Common Data
40 | public byte[] Normal { get; set; }
41 | public byte[] Alpha { get; set; }
42 |
43 | // PBR Data
44 | public byte[] Occlusion { get; set; }
45 | public byte[] Roughness { get; set; }
46 | public byte[] Metalness { get; set; }
47 | public byte[] Subsurface { get; set; }
48 |
49 |
50 | public string MaterialPath { get; set; }
51 |
52 | public bool IsSkin {
53 | get
54 | {
55 | return ModelModifiers.IsSkinMaterial(MaterialPath);
56 | }
57 | }
58 |
59 | public bool RenderBackfaces { get; set; }
60 | public TextureSampler.ETilingMode UTilingMode { get; set; }
61 | public TextureSampler.ETilingMode VTilingMode { get; set; }
62 | }
63 | ///
64 | /// This class holds the data for the textures to be used on the 3D Model
65 | ///
66 | public class PbrModelTextureData
67 | {
68 | public int Width { get; set; }
69 |
70 | public int Height { get; set; }
71 |
72 | public byte[] Diffuse { get; set; }
73 |
74 | public byte[] Specular { get; set; }
75 |
76 | public byte[] Normal { get; set; }
77 |
78 | public byte[] Alpha { get; set; }
79 |
80 | public byte[] Emissive { get; set; }
81 |
82 | public byte[] Metalness { get; set; }
83 |
84 | public byte[] Roughness{ get; set; }
85 |
86 | public string MaterialPath { get; set; }
87 |
88 | public bool IsSkin
89 | {
90 | get
91 | {
92 | return ModelModifiers.IsSkinMaterial(MaterialPath);
93 | }
94 | }
95 |
96 | public bool RenderBackfaces { get; set; }
97 | }
98 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/NeckMorphEntry.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using SharpDX;
18 | using System.Collections.Generic;
19 |
20 | namespace xivModdingFramework.Models.DataContainers
21 | {
22 | ///
23 | /// Class representing a neck morph table entry in a model, which modifies a vertex on the neck seam of a character's body when active.
24 | /// Typically 10 of these entries exist on a head mesh.
25 | /// It is unclear how each entry relates to individual vertex on the body mesh.
26 | ///
27 | public class NeckMorphEntry
28 | {
29 | ///
30 | /// Relative adjustment of the Position of the vertex.
31 | /// Its unclear how this is applied, but it seems affected by the referenced bones.
32 | ///
33 | public Vector3 PositionAdjust { get; set; }
34 |
35 | ///
36 | /// This value is unclear but preserving it is important.
37 | /// If it is incorrect, the vertex adjustments disappear when viewed from certain camera angles.
38 | /// For all known working examples, it just has the value 0x00006699.
39 | ///
40 | public uint Unknown { get; set; }
41 |
42 | ///
43 | /// Relative adjustment of the Normal of the vertex.
44 | /// Its unclear how this is applied.
45 | ///
46 | public Vector3 NormalAdjust { get; set; }
47 |
48 | ///
49 | /// A list of bones, stored as indexes in to MdlPathData.BoneList.
50 | /// For all known working examples, the referenced bones are ["j_kubi", "j_sebo_c"].
51 | /// If the incorrect bones are referenced, the neck behavior becomes erratic.
52 | /// NOTE: In the model file these are actually stored as indexes in to BoneSet 0.
53 | ///
54 | public List Bones { get; set; }
55 | }
56 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/SkeletonData.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 |
19 | namespace xivModdingFramework.Models.DataContainers
20 | {
21 | ///
22 | /// This class contains properties for the model skeleton
23 | ///
24 | ///
25 | /// The model skeleton is kept separate from the mdl file and is usually in
26 | /// the chara/human/[raceID]/skeleton/base/[bodyID] folder, it is a Havok file.
27 | ///
28 | public class SkeletonData : ICloneable
29 | {
30 | ///
31 | /// The Name of the bone
32 | ///
33 | public string BoneName { get; set; }
34 |
35 | ///
36 | /// The bone number
37 | ///
38 | public int BoneNumber { get; set; }
39 |
40 | ///
41 | /// The bone parent
42 | ///
43 | ///
44 | /// The base bone that has no parent will have a value of -1
45 | ///
46 | public int BoneParent { get; set; }
47 |
48 | ///
49 | /// The Pose Matrix for the bone
50 | ///
51 | public float[] PoseMatrix { get; set; }
52 |
53 | ///
54 | /// The Inverse Pose Matrix for the bone
55 | ///
56 | public float[] InversePoseMatrix { get; set; }
57 |
58 | public object Clone()
59 | {
60 | var c = (SkeletonData) MemberwiseClone();
61 |
62 | c.PoseMatrix = (float[]) PoseMatrix.Clone();
63 | c.InversePoseMatrix = (float[])InversePoseMatrix.Clone();
64 | return c;
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/TerrainShadowMeshData.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | namespace xivModdingFramework.Models.DataContainers
18 | {
19 | public class TerrainShadowMeshData
20 | {
21 | ///
22 | /// This data block is currently unknown
23 | ///
24 | ///
25 | /// The size of this unknown data block is [ MdlModelData.Unknown3 * 20 ]
26 | ///
27 | public byte[] TerrainShadowMeshHeader { get; set; }
28 | }
29 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/UnknownData0.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | namespace xivModdingFramework.Models.DataContainers
18 | {
19 | public class UnknownData0
20 | {
21 | ///
22 | /// This data block is currently unknown
23 | ///
24 | ///
25 | /// The size of this unknown data block is [ MdlModelData.Unknown2 * 32 ]
26 | ///
27 | public byte[] Unknown { get; set; }
28 | }
29 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/UnknownData2.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | namespace xivModdingFramework.Models.DataContainers
18 | {
19 | public class UnknownData2
20 | {
21 | ///
22 | /// This data block is currently unknown
23 | ///
24 | ///
25 | /// The size of this unknown data block is [ MdlModelData.Unknown9 * 12 ]
26 | ///
27 | public byte[] Unknown { get; set; }
28 | }
29 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/UnknownDataPatch72.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | namespace xivModdingFramework.Models.DataContainers
18 | {
19 | public class UnknownDataPatch72
20 | {
21 | ///
22 | /// This data block is currently unknown
23 | ///
24 | ///
25 | /// The size of this unknown data block is [ MdlModelData.Patch72TableSize * 16 ]
26 | ///
27 | public byte[] Unknown { get; set; }
28 | }
29 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/VertexData.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using SharpDX;
18 | using System.Collections.Generic;
19 | using HelixToolkit.SharpDX.Core;
20 |
21 | namespace xivModdingFramework.Models.DataContainers
22 | {
23 | ///
24 | /// This class contains the properties for the Vertex Data
25 | ///
26 | public class VertexData
27 | {
28 | ///
29 | /// The vertex position data in Vector3 format (X, Y, Z)
30 | ///
31 | public Vector3Collection Positions { get; set; } = new Vector3Collection();
32 |
33 | ///
34 | /// The bone weight array per vertex
35 | ///
36 | ///
37 | /// Each vertex can hold a maximum of 4 bone weights
38 | ///
39 | public List BoneWeights { get; set; } = new List();
40 |
41 | ///
42 | /// The bone index array per vertex
43 | ///
44 | ///
45 | /// Each vertex can hold a maximum of 4 bone indices
46 | ///
47 | public List BoneIndices { get; set; } = new List();
48 |
49 | ///
50 | /// The vertex normal data in Vector4 format (X, Y, Z, W)
51 | ///
52 | ///
53 | /// The W coordinate is present but has never been noticed to be anything other than 0
54 | ///
55 | public Vector3Collection Normals { get; set; } = new Vector3Collection();
56 |
57 | ///
58 | /// The vertex BiNormal data in Vector3 format (X, Y, Z)
59 | ///
60 | public Vector3Collection BiNormals { get; set; } = new Vector3Collection();
61 |
62 | ///
63 | /// The vertex BiNormal Handedness data in bytes
64 | ///
65 | public List BiNormalHandedness { get; set; } = new List();
66 |
67 | ///
68 | /// The vertex Tangent data in Vector3 format (X, Y, Z)
69 | ///
70 | public Vector3Collection FlowDirections { get; set; } = new Vector3Collection();
71 |
72 | ///
73 | /// The vertex BiNormal Handedness data in bytes
74 | ///
75 | public List FlowHandedness { get; set; } = new List();
76 |
77 | ///
78 | /// The vertex color data in Byte4 format (R, G, B, A)
79 | ///
80 | public List Colors { get; set; } = new List();
81 |
82 | ///
83 | /// Second Vertex Color Channel
84 | ///
85 | public List Colors2 { get; set; } = new List();
86 |
87 |
88 | ///
89 | /// The primary texture coordinates for the mesh in Vector2 format (X, Y)
90 | ///
91 | public Vector2Collection TextureCoordinates0 { get; set; } = new Vector2Collection();
92 |
93 | ///
94 | /// The secondary texture coordinates for the mesh in Vector2 format (X, Y)
95 | ///
96 | public Vector2Collection TextureCoordinates1 { get; set; } = new Vector2Collection();
97 | public Vector2Collection TextureCoordinates2 { get; set; } = new Vector2Collection();
98 |
99 | ///
100 | /// The index data for the mesh
101 | ///
102 | public IntCollection Indices { get; set; } = new IntCollection();
103 | }
104 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/VertexDataStruct.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using xivModdingFramework.Models.Enums;
18 |
19 | namespace xivModdingFramework.Models.DataContainers
20 | {
21 | ///
22 | /// This class contains the properties for the Vertex Data Structures
23 | ///
24 | public class VertexDataStruct
25 | {
26 |
27 | ///
28 | /// The vertex data block the data belongs to
29 | ///
30 | ///
31 | /// There are usually 2 data blocks and usually contain the following data
32 | /// Block 0: Positions, Blend Weights, Blend indices
33 | /// Block 1: Normal, Tangent, Color, Texture Coordinates
34 | ///
35 | public byte DataBlock { get; set; }
36 |
37 | ///
38 | /// The offset to the data within the Data Block
39 | ///
40 | public byte DataOffset { get; set; }
41 |
42 | ///
43 | /// The type of the data
44 | ///
45 | public VertexDataType DataType { get; set; }
46 |
47 | ///
48 | /// What the data will be used for
49 | ///
50 | public VertexUsageType DataUsage { get; set; }
51 |
52 | public byte Count { get; set; }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/xivModdingFramework/Models/DataContainers/XivMdl.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using SharpDX;
18 | using System.Collections.Generic;
19 |
20 | namespace xivModdingFramework.Models.DataContainers
21 | {
22 | ///
23 | /// This class is an internal representation of the entire sum of an uncompressed .mdl file.
24 | /// It is not used in any high-level APIs, but is often used as a storage of the many bits of data that
25 | /// either we don't know what they do, or that users have no interaction with, but are still parts of the
26 | /// final .mdl file.
27 | ///
28 | public class XivMdl
29 | {
30 |
31 | ///
32 | /// The path to this mdl file
33 | ///
34 | public string MdlPath { get; set; }
35 |
36 | public ushort MdlVersion { get; set; }
37 |
38 | ///
39 | /// The path data contained in the mdl file
40 | ///
41 | public MdlPathData PathData { get; set; }
42 |
43 | ///
44 | /// The model data contained in the mdl file
45 | ///
46 | public MdlModelData ModelData { get; set; }
47 |
48 | ///
49 | /// Currently unknown data
50 | ///
51 | public UnknownData0 UnkData0 { get; set; }
52 |
53 | ///
54 | /// The list containing the info for each Level of Detail of the model
55 | ///
56 | public List LoDList { get; set; }
57 |
58 | ///
59 | /// The data block containing attribute information
60 | ///
61 | public AttributeDataBlock AttrDataBlock { get; set; }
62 |
63 | ///
64 | /// Currently unknown data
65 | ///
66 | public TerrainShadowMeshData UnkData1 { get; set; }
67 |
68 | ///
69 | /// Currently unknown data
70 | ///
71 | public UnknownData2 UnkData2 { get; set; }
72 |
73 | ///
74 | /// The data block containing material information
75 | ///
76 | public MaterialDataBlock MatDataBlock { get; set; }
77 |
78 | ///
79 | /// The data block containing bone information
80 | ///
81 | public BoneDataBlock BoneDataBlock { get; set; }
82 |
83 | ///
84 | /// The list continaing each of the Bone Index Lists for each LoD
85 | ///
86 | public List MeshBoneSets { get; set; }
87 |
88 | ///
89 | /// The data containing the information for mesh shapes
90 | ///
91 | public ShapeData MeshShapeData { get; set; }
92 |
93 | ///
94 | /// The data containing the information for the bone indices used by mesh parts
95 | ///
96 | public BoneSet PartBoneSets { get; set; }
97 |
98 | ///
99 | /// The size of the padded bytes immediately following
100 | ///
101 | public byte PaddingSize { get; set; }
102 |
103 | ///
104 | /// The padded bytes
105 | ///
106 | public byte[] PaddedBytes { get; set; }
107 |
108 | ///
109 | // Bounding Boxes for the model
110 | ///
111 | public List> BoundingBoxes { get; set; }
112 |
113 | ///
114 | /// Bone Bounding Boxes
115 | ///
116 | public List> BoneBoundingBoxes { get; set; }
117 |
118 | ///
119 | /// Bone Bounding Boxes
120 | ///
121 | public List> BonelessPartBoundingBoxes { get; set; }
122 |
123 | ///
124 | /// Flag set when the model has shape data
125 | ///
126 | public bool HasShapeData { get; set; }
127 |
128 | ///
129 | /// The list containing the info for each etra Level of Detail of the model
130 | ///
131 | ///
132 | /// This happens when the sum of all LoD mesh counts is less than the model data mesh count.
133 | /// The number of extra LoDs seems to be the value of Unknown10
134 | ///
135 | public List ExtraLoDList { get; set; }
136 |
137 | ///
138 | /// The list of extra MeshData for the Model
139 | ///
140 | ///
141 | /// This happens when the sum of all LoD mesh counts is less than the model data mesh count
142 | ///
143 | public List ExtraMeshData { get; set; }
144 |
145 | ///
146 | /// This data is present on heads and seems to affect the shape of the neck on the body mesh
147 | ///
148 | public List NeckMorphTable { get; set; }
149 |
150 | ///
151 | /// Currently unknown data
152 | ///
153 | public UnknownDataPatch72 UnkDataPatch72 { get; set; }
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/xivModdingFramework/Models/Enums/VertexDataType.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System.Collections.Generic;
18 |
19 | namespace xivModdingFramework.Models.Enums
20 | {
21 | ///
22 | /// Enum containing the Data Type for data entries in the Vertex Data Blocks
23 | ///
24 | public enum VertexDataType
25 | {
26 | Float1 = 0x0,
27 | Float2 = 0x1,
28 | Float3 = 0x2,
29 | Float4 = 0x3,
30 | Ubyte4 = 0x5,
31 | Short2 = 0x6,
32 | Short4 = 0x7,
33 | Ubyte4n = 0x8,
34 | Short2n = 0x9,
35 | Short4n = 0xA,
36 | Ushort2n = 0xB,
37 | Ushort4n = 0xC,
38 | Half2 = 0x0D,
39 | Half4 = 0x0E,
40 | //Half2D = 0x0D,
41 | //Half4E = 0x0E,
42 | UByte8 = 0x11
43 | }
44 |
45 | public static class VertexDataTypeInfo
46 | {
47 | public static Dictionary Sizes = new Dictionary() {
48 | { VertexDataType.Float1, 4 },
49 | { VertexDataType.Float2, 8 },
50 | { VertexDataType.Float3, 12 },
51 | { VertexDataType.Float4, 16 },
52 | { VertexDataType.Ubyte4, 4 },
53 | { VertexDataType.Short2, 4 },
54 | { VertexDataType.Short4, 8 },
55 | { VertexDataType.Ubyte4n, 4 },
56 | { VertexDataType.Short2n, 4 },
57 | { VertexDataType.Short4n, 8 },
58 | { VertexDataType.Ushort2n, 4 },
59 | { VertexDataType.Ushort4n, 8 },
60 | { VertexDataType.Half2, 4 },
61 | { VertexDataType.Half4, 8 },
62 | { VertexDataType.UByte8, 8 },
63 | };
64 |
65 | }
66 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/Enums/VertexUsageType.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | namespace xivModdingFramework.Models.Enums
18 | {
19 | ///
20 | /// Enum containing the what the data entries in the Vertex Data Block will be used for
21 | ///
22 | public enum VertexUsageType
23 | {
24 | Position = 0x0,
25 | BoneWeight = 0x1,
26 | BoneIndex = 0x2,
27 | Normal = 0x3,
28 | TextureCoordinate = 0x4,
29 | Flow = 0x5,
30 | Binormal = 0x6,
31 | Color = 0x7
32 | }
33 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Models/FileTypes/Obj.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.Collections.Generic;
19 | using System.IO;
20 | using System.Text;
21 | using xivModdingFramework.General.Enums;
22 | using xivModdingFramework.Helpers;
23 | using xivModdingFramework.Items.Interfaces;
24 | using xivModdingFramework.Models.DataContainers;
25 |
26 | namespace xivModdingFramework.Models.FileTypes
27 | {
28 | ///
29 | /// This class handles Obj files
30 | ///
31 | public class Obj
32 | {
33 | private readonly DirectoryInfo _gameDirectory;
34 |
35 | public Obj(DirectoryInfo gameDirectory)
36 | {
37 | _gameDirectory = gameDirectory;
38 | }
39 |
40 | ///
41 | /// Exports each mesh as an obj file
42 | ///
43 | public void ExportObj(TTModel model, string path)
44 | {
45 | var meshGroups = model.MeshGroups;
46 |
47 | Directory.CreateDirectory(Path.GetDirectoryName(path));
48 |
49 | try
50 | {
51 | var meshNum = 0;
52 | foreach (var mesh in meshGroups)
53 | {
54 | var modelName = $"{Path.GetFileNameWithoutExtension(path)}_{meshNum}.obj";
55 | var savePath = Path.GetDirectoryName(path) + "\\" + modelName;
56 |
57 | meshNum++;
58 | File.WriteAllText(savePath, ExportObj(mesh));
59 | }
60 | } catch(Exception ex)
61 | {
62 | throw ex;
63 | }
64 | }
65 |
66 | public string ExportObj(TTMeshGroup mesh)
67 | {
68 | var sb = new StringBuilder();
69 |
70 |
71 | // Merge the index and vertex lists.
72 | var vertices = new List((int)mesh.VertexCount);
73 | var indices = new List((int)mesh.IndexCount);
74 | foreach (var p in mesh.Parts)
75 | {
76 | var preVertexCount = vertices.Count;
77 | vertices.AddRange(p.Vertices);
78 | foreach (var i in p.TriangleIndices)
79 | {
80 | indices.Add(i + preVertexCount);
81 | }
82 | }
83 |
84 | foreach (var v in vertices)
85 | {
86 | sb.AppendLine($"v {v.Position.X:N5} {v.Position.Y:N5} {v.Position.Z:N5}");
87 | }
88 |
89 | foreach (var v in vertices)
90 | {
91 | var ox = v.UV1.X - Math.Truncate(v.UV1.X);
92 | var oy = v.UV1.Y - Math.Truncate(v.UV1.Y);
93 | sb.AppendLine($"vt {ox:N5} {(1 - oy):N5}");
94 | }
95 |
96 | foreach (var v in vertices)
97 | {
98 | sb.AppendLine($"vn {v.Normal.X:N5} {v.Normal.Y:N5} {v.Normal.Z:N5}");
99 | }
100 |
101 | for (var i = 0; i < indices.Count; i += 3)
102 | {
103 | var index1 = indices[i] + 1;
104 | var index2 = indices[i + 1] + 1;
105 | var index3 = indices[i + 2] + 1;
106 | sb.AppendLine($"f {index1}/{index1}/{index1} {index2}/{index2}/{index2} {index3}/{index3}/{index3}");
107 | }
108 |
109 |
110 | return sb.ToString();
111 | }
112 | }
113 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/DataContainers/BackupModPackData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using xivModdingFramework.Mods.Interfaces;
4 |
5 | namespace xivModdingFramework.Mods.DataContainers
6 | {
7 | public class BackupModPackData : IModPackData
8 | {
9 | ///
10 | /// The name of the mod pack
11 | ///
12 | public string Name { get; set; }
13 |
14 | ///
15 | /// The mod pack author
16 | ///
17 | public string Author { get; set; } = "TexTools";
18 |
19 | ///
20 | /// The mod pack version
21 | ///
22 | public Version Version { get; set; } = new Version("1.0.0");
23 |
24 | ///
25 | /// The modpack Url
26 | ///
27 | public string Url { get; set; } = "";
28 |
29 | ///
30 | /// The description for the mod pack
31 | ///
32 | public string Description { get; set; } = "";
33 |
34 | ///
35 | /// The list of mods to back up
36 | ///
37 | public List ModsToBackup { get; set; }
38 | }
39 |
40 | public class BackupModData
41 | {
42 | ///
43 | /// Simple mod data
44 | ///
45 | public SimpleModData SimpleModData { get; set; }
46 |
47 | ///
48 | /// Mod pack that the mod is a part of
49 | ///
50 | public ModPack? ModPack { get; set; }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/DataContainers/ModGroup.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System.Collections.Generic;
18 |
19 | namespace xivModdingFramework.Mods.DataContainers
20 | {
21 | public class ModGroup
22 | {
23 | ///
24 | /// The name of the mod options group
25 | ///
26 | public string GroupName { get; set; }
27 |
28 | ///
29 | /// The type of selection for the options in the group
30 | ///
31 | ///
32 | /// This is either Single Selection or Multi Selection
33 | ///
34 | public string SelectionType { get; set; }
35 |
36 | ///
37 | /// The list of options in the group
38 | ///
39 | public List OptionList { get; set; }
40 | }
41 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/DataContainers/ModOption.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using SixLabors.ImageSharp;
18 | using System.Collections.Generic;
19 |
20 | namespace xivModdingFramework.Mods.DataContainers
21 | {
22 | public class ModOption
23 | {
24 | ///
25 | /// The name of the option
26 | ///
27 | public string Name { get; set; }
28 |
29 | ///
30 | /// The option description
31 | ///
32 | public string Description { get; set; }
33 |
34 | ///
35 | /// The preview image for the option
36 | ///
37 | public Image Image { get; set; }
38 |
39 | ///
40 | /// This is the path for the Image
41 | ///
42 | public string ImageFileName { get; set; }
43 |
44 | ///
45 | /// A dictionary containing the (key)mod path and (value)mod data
46 | ///
47 | public Dictionary Mods { get; } = new Dictionary();
48 |
49 | ///
50 | /// The name of the group this mod option belongs to
51 | ///
52 | public string GroupName { get; set; }
53 |
54 | ///
55 | /// The selection type for this mod option
56 | ///
57 | public string SelectionType { get; set; }
58 |
59 | ///
60 | /// The status of the radio or checkbox
61 | ///
62 | public bool IsChecked { get; set; }
63 | }
64 |
65 | public class ModData
66 | {
67 | ///
68 | /// The name of the item
69 | ///
70 | public string Name { get; set; }
71 |
72 | ///
73 | /// The category of the item
74 | ///
75 | public string Category { get; set; }
76 |
77 | ///
78 | /// The full path of the item
79 | ///
80 | public string FullPath { get; set; }
81 |
82 | ///
83 | /// Whether or not this item is a default SE file.
84 | /// These files are still included in full, for the sake
85 | /// of backwards compatability, but in the future may have
86 | /// handling to simply disable existing mods, rather than copy over.
87 | ///
88 | public bool IsDefault = false;
89 |
90 | ///
91 | /// The raw mod data
92 | ///
93 | public byte[] ModDataBytes { get; set; }
94 |
95 | }
96 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/DataContainers/ModPackData.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.Collections.Generic;
19 | using xivModdingFramework.Mods.Interfaces;
20 |
21 | namespace xivModdingFramework.Mods.DataContainers
22 | {
23 | public class ModPackData : IModPackData
24 | {
25 | ///
26 | /// The name of the mod pack
27 | ///
28 | public string Name { get; set; }
29 |
30 | ///
31 | /// The mod pack author
32 | ///
33 | public string Author { get; set; }
34 |
35 | ///
36 | /// The mod pack version
37 | ///
38 | public Version Version { get; set; }
39 |
40 | ///
41 | /// The description for the mod pack
42 | ///
43 | public string Description { get; set; }
44 |
45 | ///
46 | /// Author's supplied URL for the modpack.
47 | ///
48 | public string Url { get; set; }
49 |
50 | ///
51 | /// A list of pages containing a list of mod groups for that particular page
52 | ///
53 | public List ModPackPages { get; set; }
54 |
55 | public class ModPackPage
56 | {
57 | ///
58 | /// The page index
59 | ///
60 | public int PageIndex { get; set; }
61 |
62 | ///
63 | /// The list of mod groups contained in the mod pack
64 | ///
65 | public List ModGroups { get; set; }
66 |
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/DataContainers/OriginalModList.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2019 Rafael Gonzalez - All Rights Reserved
2 | //
3 | // This program is free software: you can redistribute it and/or modify
4 | // it under the terms of the GNU General Public License as published by
5 | // the Free Software Foundation, either version 3 of the License, or
6 | // (at your option) any later version.
7 | //
8 | // This program is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU General Public License
14 | // along with this program. If not, see .
15 |
16 | namespace xivModdingFramework.Mods.DataContainers
17 | {
18 | class OriginalModList
19 | {
20 | ///
21 | /// The modified items category
22 | ///
23 | public string category { get; set; }
24 |
25 | ///
26 | /// The modified items name
27 | ///
28 | public string name { get; set; }
29 |
30 | ///
31 | /// The internal path of the modified item
32 | ///
33 | public string fullPath { get; set; }
34 |
35 | ///
36 | /// The oringial offset of the modified item
37 | ///
38 | ///
39 | /// Used to revert to the items original texture
40 | ///
41 | public int originalOffset { get; set; }
42 |
43 | ///
44 | /// The modified offset of the modified item
45 | ///
46 | public int modOffset { get; set; }
47 |
48 | ///
49 | /// The size of the modified items data
50 | ///
51 | ///
52 | /// When importing a previously modified texture, this value is used to determine whether the modified data will be overwritten
53 | ///
54 | public int modSize { get; set; }
55 |
56 | ///
57 | /// The dat file where the modified item is located
58 | ///
59 | public string datFile { get; set; }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/DataContainers/OriginalModPackJson.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 |
18 | namespace xivModdingFramework.Mods.DataContainers
19 | {
20 | public class OriginalModPackJson
21 | {
22 | ///
23 | /// The name of the item
24 | ///
25 | public string Name { get; set; }
26 |
27 | ///
28 | /// The item category
29 | ///
30 | public string Category { get; set; }
31 |
32 | ///
33 | /// The full path of the item data for the game
34 | ///
35 | public string FullPath { get; set; }
36 |
37 | ///
38 | /// The offset to where the mod data is located
39 | ///
40 | public long ModOffset { get; set; }
41 |
42 | ///
43 | /// The size of the mod data
44 | ///
45 | public int ModSize { get; set; }
46 |
47 | ///
48 | /// The dat file associated with the item
49 | ///
50 | public string DatFile { get; set; }
51 | }
52 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/DataContainers/SimpleModPackData.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | using System;
18 | using System.Collections.Generic;
19 | using xivModdingFramework.Mods.Interfaces;
20 |
21 | namespace xivModdingFramework.Mods.DataContainers
22 | {
23 | public class SimpleModPackData : IModPackData
24 | {
25 | ///
26 | /// The name of the mod pack
27 | ///
28 | public string Name { get; set; }
29 |
30 | ///
31 | /// The mod pack author
32 | ///
33 | public string Author { get; set; }
34 |
35 | ///
36 | /// The mod pack version
37 | ///
38 | public Version Version { get; set; }
39 |
40 | ///
41 | /// The modpack Url
42 | ///
43 | public string Url { get; set; } = "";
44 |
45 | ///
46 | /// The description for the mod pack
47 | ///
48 | public string Description { get; set; }
49 |
50 | ///
51 | /// List of simple mod data
52 | ///
53 | public List SimpleModDataList { get; set; }
54 |
55 | }
56 |
57 | public class SimpleModData
58 | {
59 | ///
60 | /// The name of the item
61 | ///
62 | public string Name { get; set; }
63 |
64 | ///
65 | /// The category of the item
66 | ///
67 | public string Category { get; set; }
68 |
69 | ///
70 | /// The full path of the item data for the game
71 | ///
72 | public string FullPath { get; set; }
73 |
74 | ///
75 | /// The offset to where the mod data is located
76 | ///
77 | public long ModOffset { get; set; }
78 |
79 | ///
80 | /// If the entry is SE Default data or not.
81 | ///
82 | public bool IsDefault = false;
83 |
84 | ///
85 | /// The size of the mod data
86 | ///
87 | public int ModSize { get; set; }
88 |
89 | ///
90 | /// The dat file associated with the item
91 | ///
92 | public string DatFile { get; set; }
93 | }
94 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/DataContainers/TransactionModList.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace xivModdingFramework.Mods.DataContainers
7 | {
8 | ///
9 | /// Wrapped ModList handler that reports to the active transaction when changes are made.
10 | ///
11 | internal class TransactionModList : ModList
12 | {
13 | protected override void INTERNAL_AddOrUpdateMod(Mod mod)
14 | {
15 | // Loop back to notify the Transaction of our changes.
16 | var tx = ModTransaction.ActiveTransaction;
17 | if (tx != null)
18 | {
19 | var originalMod = GetMod(mod.FilePath);
20 | tx.INTERNAL_OnModUpdate(mod.FilePath, originalMod, mod);
21 | }
22 | base.INTERNAL_AddOrUpdateMod(mod);
23 | }
24 |
25 | protected override void INTERNAL_RemoveMod(string path)
26 | {
27 | // Loop back to notify the Transaction of our changes.
28 | var tx = ModTransaction.ActiveTransaction;
29 | if (tx != null)
30 | {
31 | var originalMod = GetMod(path);
32 | tx.INTERNAL_OnModUpdate(path, originalMod, null);
33 | }
34 | base.INTERNAL_RemoveMod(path);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/Enums/EModState.cs:
--------------------------------------------------------------------------------
1 | // xivModdingFramework
2 | // Copyright © 2018 Rafael Gonzalez - All Rights Reserved
3 | //
4 | // This program is free software: you can redistribute it and/or modify
5 | // it under the terms of the GNU General Public License as published by
6 | // the Free Software Foundation, either version 3 of the License, or
7 | // (at your option) any later version.
8 | //
9 | // This program is distributed in the hope that it will be useful,
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | // GNU General Public License for more details.
13 | //
14 | // You should have received a copy of the GNU General Public License
15 | // along with this program. If not, see .
16 |
17 | namespace xivModdingFramework.Mods.Enums
18 | {
19 | public enum EModState
20 | {
21 | // The file is modded, but points to an offset that is neither the modded or original file.
22 | Invalid,
23 |
24 | // The file has not been modded at all, and exists only in its default game state.
25 | UnModded,
26 |
27 | // The file is modded, and enabled.
28 | Enabled,
29 |
30 | // The file is modded, but the mod is disabled.
31 | Disabled
32 | }
33 | }
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/FileTypes/ModelKit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using xivModdingFramework.General.Enums;
5 | using xivModdingFramework.Materials.DataContainers;
6 | using xivModdingFramework.Models.DataContainers;
7 |
8 | namespace xivModdingFramework.Mods.FileTypes
9 | {
10 | ///
11 | /// The high-level representation of a model kit.
12 | ///
13 | public class ModelKit
14 | {
15 | public string Name;
16 | public string Author;
17 | public string Version;
18 | public string Url;
19 | public string Description;
20 |
21 | public string Image;
22 |
23 |
24 | public TTModel Model;
25 | public XivMtrl Material;
26 | public XivRace OriginalRace;
27 |
28 | }
29 |
30 |
31 |
32 | ///
33 | /// The base Low-Level JSON representation for a model kit.
34 | ///
35 | public class ModelKitJson
36 | {
37 | public string Name;
38 | public string Author;
39 | public string Version;
40 | public string Url;
41 | public string Description;
42 |
43 |
44 | ///
45 | /// Path to the preview image within the Zip file.
46 | ///
47 | public string Image;
48 |
49 | ///
50 | /// The original Race identifier if there was one for the model.
51 | /// Should be NULL or Empty String if the model should not be racially scaled.
52 | ///
53 | public string OriginalRace;
54 |
55 | ///
56 | /// Model file path within the zip file.
57 | ///
58 | public string Model;
59 |
60 | ///
61 | /// Model-listed Material Name => Zip Path for Materials.
62 | ///
63 | public Dictionary Materials;
64 |
65 | ///
66 | /// FFXIV Internal Path => Zip Path for textures.
67 | /// Textures should only be imported by default if they do not exist.
68 | ///
69 | public Dictionary Textures;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/Interfaces/IModPackData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace xivModdingFramework.Mods.Interfaces
4 | {
5 | public interface IModPackData
6 | {
7 | ///
8 | /// The name of the mod pack
9 | ///
10 | public string Name { get; set; }
11 |
12 | ///
13 | /// The mod pack author
14 | ///
15 | public string Author { get; set; }
16 |
17 | ///
18 | /// The mod pack version
19 | ///
20 | public Version Version { get; set; }
21 |
22 | ///
23 | /// The description for the mod pack
24 | ///
25 | public string Description { get; set; }
26 |
27 | ///
28 | /// Author's supplied URL for the modpack.
29 | ///
30 | public string Url { get; set; }
31 | }
32 |
33 | ///
34 | /// Baseline modpack data, just used for handling metadata.
35 | /// Only used in PMP creation currently.
36 | ///
37 | public class BaseModpackData : IModPackData
38 | {
39 | public string Name { get; set; }
40 | public string Author { get; set; }
41 | public Version Version { get; set; }
42 | public string Description { get; set; }
43 | public string Url { get; set; }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/xivModdingFramework/Mods/ShrinkRay.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using xivModdingFramework.Helpers;
8 | using xivModdingFramework.Models.DataContainers;
9 | using xivModdingFramework.Models.FileTypes;
10 | using xivModdingFramework.Mods.DataContainers;
11 | using xivModdingFramework.SqPack.FileTypes;
12 | using xivModdingFramework.Textures.DataContainers;
13 | using xivModdingFramework.Textures.FileTypes;
14 |
15 | namespace xivModdingFramework.Mods
16 | {
17 | public static class ShrinkRay
18 | {
19 | public class ShrinkRaySettings
20 | {
21 | public bool ResaveModels = true;
22 | public bool RemoveExtraFiles = true;
23 | public int MaxTextureSize = 2048;
24 | }
25 |
26 | public static async Task ShrinkModpack(string modpackPath, ShrinkRaySettings settings = null)
27 | {
28 | var data = await WizardData.FromModpack(modpackPath);
29 | if (data == null)
30 | {
31 | throw new ArgumentException("The given modpack does not exist or is invalid.");
32 | }
33 |
34 | return await ShrinkModpack(data);
35 | }
36 | public static async Task ShrinkModpack(WizardData modpack, ShrinkRaySettings settings = null)
37 | {
38 | if(settings == null)
39 | {
40 | settings = new ShrinkRaySettings();
41 | }
42 |
43 | modpack.ClearNulls();
44 |
45 | await Task.Run(async () =>
46 | {
47 | var rtx = ModTransaction.BeginReadonlyTransaction();
48 | await ForEachOptionParalell(modpack, async (opt) =>
49 | {
50 | var newKeys = new Dictionary(opt.Files.Count);
51 | foreach (var kv in opt.Files)
52 | {
53 | var path = kv.Key;
54 | var file = kv.Value;
55 | var ext = Path.GetExtension(path);
56 |
57 | if (settings.ResaveModels && ext == ".mdl")
58 | {
59 | file = await ResaveModel(path, file);
60 | }
61 | else if (ext == ".tex" || ext == ".atex")
62 | {
63 | file = await ResaveTexture(path, file, settings.MaxTextureSize);
64 | }
65 |
66 | newKeys.Add(path, file);
67 | }
68 |
69 | opt.Files = newKeys;
70 | });
71 |
72 | if (settings.RemoveExtraFiles)
73 | {
74 | modpack.ExtraFiles = new Dictionary();
75 | }
76 | });
77 |
78 | return modpack;
79 | }
80 |
81 | private static async Task ForEachOptionParalell(WizardData data, Func act)
82 | {
83 | var tasks = new List();
84 | foreach (var p in data.DataPages)
85 | {
86 | foreach (var g in p.Groups)
87 | {
88 | foreach (var o in g.Options)
89 | {
90 | var sData = o.StandardData;
91 | if (sData == null) continue;
92 |
93 | tasks.Add(Task.Run(async () => await act(sData)));
94 | }
95 | }
96 | }
97 | await Task.WhenAll(tasks);
98 | }
99 |
100 | private static async Task ResaveModel(string path, FileStorageInformation model)
101 | {
102 | var file = model;
103 | try
104 | {
105 | var data = await TransactionDataHandler.GetUncompressedFile(model);
106 | var raw = Mdl.GetXivMdl(data, path);
107 | var ttm = await TTModel.FromRaw(raw);
108 | ttm.MdlVersion = 6;
109 |
110 | var res = Mdl.MakeUncompressedMdlFile(ttm, raw);
111 | var tempPath = IOUtil.GetFrameworkTempFile();
112 | File.WriteAllBytes(tempPath, res);
113 |
114 | file = new FileStorageInformation()
115 | {
116 | FileSize = res.Length,
117 | RealOffset = 0,
118 | RealPath = tempPath,
119 | StorageType = EFileStorageType.UncompressedIndividual,
120 | };
121 | } catch(Exception ex)
122 | {
123 | Trace.WriteLine(ex);
124 | }
125 | return file;
126 | }
127 |
128 |
129 | private static async Task ResaveTexture(string path, FileStorageInformation texture, int maxSize = -1)
130 | {
131 | var file = texture;
132 | try
133 | {
134 | var data = await TransactionDataHandler.GetUncompressedFile(texture);
135 | var xTex = XivTex.FromUncompressedTex(data);
136 |
137 | await Tex.EnsureValidSize(xTex, maxSize);
138 | var res = xTex.ToUncompressedTex();
139 | var tempPath = IOUtil.GetFrameworkTempFile();
140 | File.WriteAllBytes(tempPath, res);
141 |
142 | file = new FileStorageInformation()
143 | {
144 | FileSize = res.Length,
145 | RealOffset = 0,
146 | RealPath = tempPath,
147 | StorageType = EFileStorageType.UncompressedIndividual,
148 | };
149 | }
150 | catch (Exception ex)
151 | {
152 | Trace.WriteLine(ex);
153 | }
154 | return file;
155 | }
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/xivModdingFramework/Resources/DB/item_sets.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TexTools/xivModdingFramework/4e6bd716228c8820738e7cbd1315f1a685bc1f80/xivModdingFramework/Resources/DB/item_sets.db
--------------------------------------------------------------------------------
/xivModdingFramework/Resources/DB/shader_info.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TexTools/xivModdingFramework/4e6bd716228c8820738e7cbd1315f1a685bc1f80/xivModdingFramework/Resources/DB/shader_info.db
--------------------------------------------------------------------------------
/xivModdingFramework/Resources/DB/uv_heuristics.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TexTools/xivModdingFramework/4e6bd716228c8820738e7cbd1315f1a685bc1f80/xivModdingFramework/Resources/DB/uv_heuristics.db
--------------------------------------------------------------------------------
/xivModdingFramework/Resources/DefaultTextures/Colorset.dat:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/xivModdingFramework/Resources/DefaultTextures/Colorset.dds:
--------------------------------------------------------------------------------
1 | DDS | q <