Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delta/material viewer #151

Merged
merged 23 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ba300ab
Simple Material Viewer
DeltaDesigns Oct 20, 2023
8d40039
Add "Materials" button to main menu
DeltaDesigns Oct 20, 2023
4f28c03
Support for Cube/3D textures in list, small UI changes
DeltaDesigns Oct 23, 2023
bdca379
Initial work on TFX stuff, some shader cleanup
DeltaDesigns Oct 24, 2023
517f276
Update some TFX op codes with real names
DeltaDesigns Oct 25, 2023
30b351a
Update op codes to newest again
DeltaDesigns Oct 25, 2023
14c16aa
Very WIP interpreter
DeltaDesigns Oct 26, 2023
99f81e5
Use placeholder vector4 for bytecode insertions
DeltaDesigns Oct 27, 2023
597cce0
More TFX, allow material exporting
DeltaDesigns Nov 5, 2023
7683976
More interpreter stuff
DeltaDesigns Nov 14, 2023
fa32428
Take a guess
DeltaDesigns Nov 15, 2023
06b403d
(TFX) Divide, Floor, Ceil and Sign. Reorder/clean up
DeltaDesigns Nov 16, 2023
195a71c
More tfx stuff, vs buffer containers for all versions
DeltaDesigns Dec 1, 2023
16d8f1f
Only show CB0 in material view
DeltaDesigns Dec 6, 2023
041f078
Merge branch 'main' into delta/material-viewer
DeltaDesigns Dec 6, 2023
3deeced
(S2) Try to add evaluated TFX bytecode to vmat
DeltaDesigns Dec 6, 2023
aa75309
(S2) Remove SSR stuff for now, update interpreter
DeltaDesigns Dec 7, 2023
f8ee476
(S2) Fix rare case where a cbuffer value is used as a sample texcoord
DeltaDesigns Dec 8, 2023
bd4f406
Lerp, Lerp Constants
DeltaDesigns Dec 12, 2023
ccdf438
(S2 & TFX) Some fixes for compiling errors
DeltaDesigns Dec 15, 2023
155bb12
(S2) Replace null materials with default black
DeltaDesigns Dec 15, 2023
442e5d5
Merge branch 'main' into delta/material-viewer
MontagueM May 25, 2024
6a8e512
fixes
MontagueM May 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 10 additions & 25 deletions Charm/DevView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Tiger.Schema.Audio;
using Tiger.Schema.Entity;
using Tiger.Schema.Investment;
using Tiger.Schema.Shaders;
using Tiger.Schema.Static;

namespace Charm;
Expand All @@ -36,8 +37,6 @@ private void OnControlLoaded(object sender, RoutedEventArgs routedEventArgs)
_mainWindow = Window.GetWindow(this) as MainWindow;
_fbxHandler = new FbxHandler(false);
HashLocation.Text = $"PKG:\nPKG ID:\nEntry Index:";

//RipAndTear();
}

private void TagHashBoxKeydown(object sender, KeyEventArgs e)
Expand Down Expand Up @@ -232,6 +231,15 @@ private void AddWindow(FileHash hash)
_mainWindow.MakeNewTab(hash, dialogueView);
_mainWindow.SetNewestTabSelected();
break;
case 0x808071E8:
case 0x80806DAA:
var materialView = new MaterialView();
materialView.Load(hash);
_mainWindow.MakeNewTab(hash, materialView);
_mainWindow.SetNewestTabSelected();
IMaterial material = FileResourcer.Get().GetFileInterface<IMaterial>(hash);
material.SaveMaterial($"{ConfigSubsystem.Get().GetExportSavePath()}/Materials/{hash}");
break;
case 0x80801AB5:
case 0x808073A5:
case 0x80806F07: //Entity model
Expand Down Expand Up @@ -324,27 +332,4 @@ private void ExportDevMapButton_OnClick(object sender, RoutedEventArgs e)
StaticView.ExportStatic(new FileHash(asset), asset, ExportTypeFlag.Full, "devmap");
}
}

// Cleaverly done (insert name) but you're not supposed to be here. As a matter of fact, you're not.
// Get back where you belong and forget about all this...Until we meet again.
public void RipAndTear()
{
bool PackageFilterFunc(string packagePath) => packagePath.Contains("investment") || packagePath.Contains("client_startup") || packagePath.Contains("boot");
ConcurrentHashSet<FileHash> allHashes = PackageResourcer.Get().GetAllHashes(PackageFilterFunc);
Parallel.ForEach(allHashes, (val, state, i) =>
{
if (val.GetReferenceHash().IsValid() && val.GetReferenceHash().ToString().EndsWith("8080"))
{
string path = $"C:\\Users\\Michael\\Desktop\\out\\D2\\{val.GetReferenceHash()}_{val}.bin";
using (var fileStream = new FileStream(path, FileMode.Create))
{
using (var writer = new BinaryWriter(fileStream))
{
byte[] data = FileResourcer.Get().GetFile(val).GetData();
writer.Write(data);
}
}
}
});
}
}
16 changes: 16 additions & 0 deletions Charm/MainMenuView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,22 @@
FontSize="42"
Text="TEXTURES" />
</Button>
<Button
Height="75"
Margin="20,0,20,40"
Padding="20,20,20,20"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Click="AllMaterialsViewButton_OnClick"
Style="{StaticResource MaterialDesignPaperDarkButton}">
<TextBlock
Padding="0,10,0,10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{DynamicResource ResourceKey=Haas Grot Text 55 Roman}"
FontSize="42"
Text="MATERIALS" />
</Button>
</StackPanel>
</StackPanel>
</StackPanel>
Expand Down
8 changes: 8 additions & 0 deletions Charm/MainMenuView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,12 @@ private void AllTexturesViewButton_OnClick(object sender, RoutedEventArgs e)
_mainWindow.MakeNewTab("textures", tagListView);
_mainWindow.SetNewestTabSelected();
}

private void AllMaterialsViewButton_OnClick(object sender, RoutedEventArgs e)
{
TagListViewerView tagListView = new TagListViewerView();
tagListView.LoadContent(ETagListType.MaterialList);
_mainWindow.MakeNewTab("materials", tagListView);
_mainWindow.SetNewestTabSelected();
}
}
Loading
Loading