├── .gitattributes
├── .github
├── ScreenshotMK.png
└── ScreenshotOdyssey.png
├── .gitignore
├── EditorCore.sln
├── EditorCore
├── App.config
├── EditorCore.csproj
├── EditorForm.Designer.cs
├── EditorForm.cs
├── EditorForm.resx
├── EditorFroms
│ ├── SearchResult.Designer.cs
│ ├── SearchResult.cs
│ └── SearchResult.resx
├── OtherForms
│ ├── FrmCredits.Designer.cs
│ ├── FrmCredits.cs
│ ├── FrmCredits.resx
│ ├── GameModuleSelect.Designer.cs
│ ├── GameModuleSelect.cs
│ ├── GameModuleSelect.resx
│ ├── Settings.Designer.cs
│ ├── Settings.cs
│ └── Settings.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── packages.config
├── EditorCoreCommon
├── Common
│ └── OBJ.cs
├── CustomClasses.cs
├── EditorCoreCommon.csproj
├── Forms
│ ├── AddBymlPropertyDialog.Designer.cs
│ ├── AddBymlPropertyDialog.cs
│ ├── AddBymlPropertyDialog.resx
│ ├── LoadingForm.Designer.cs
│ ├── LoadingForm.cs
│ └── LoadingForm.resx
├── Interfaces
│ ├── EditorChild.cs
│ ├── Extensions.cs
│ ├── IGameSpecificModule.cs
│ ├── ILevel.cs
│ ├── ILevelObj.cs
│ └── IPathObj.cs
├── OpenFileHandler.cs
├── Properties
│ └── AssemblyInfo.cs
├── PropertyGridTypes.cs
├── UpdateCheck.cs
└── packages.config
├── FileFormatPlugins
├── BfresLib
│ ├── BFRES.cs
│ ├── BfresConverter.cs
│ ├── BfresLib.csproj
│ ├── FileData.cs
│ ├── FileOutput.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── BnTxx
│ ├── ASTC.cs
│ ├── BCn.cs
│ ├── BlockLinearSwizzle.cs
│ ├── BnTxx.csproj
│ ├── Formats
│ │ ├── BinaryTexture.cs
│ │ ├── ChannelType.cs
│ │ ├── InvalidSignatureException.cs
│ │ ├── PatriciaTree.cs
│ │ ├── PatriciaTreeNode.cs
│ │ ├── Texture.cs
│ │ ├── TextureFormatType.cs
│ │ ├── TextureFormatVar.cs
│ │ └── TextureType.cs
│ ├── ISwizzle.cs
│ ├── PixelDecoder.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Utilities
│ │ ├── BitUtils.cs
│ │ └── IOUtils.cs
│ └── packages.config
├── ByamlLib
│ ├── Byaml
│ │ ├── ByamlException.cs
│ │ ├── ByamlFile.cs
│ │ ├── ByamlNodeType.cs
│ │ ├── ByamlPathPoint.cs
│ │ ├── ByamlViewer.cs
│ │ ├── ByamlViewer.designer.cs
│ │ ├── ByamlViewer.resx
│ │ ├── BymlPathPointEditor.Designer.cs
│ │ ├── BymlPathPointEditor.cs
│ │ ├── BymlPathPointEditor.resx
│ │ └── XmlConverter.cs
│ ├── ByamlExt.cs
│ ├── ByamlExt.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── KCLExt
│ ├── BinaryDataReaderExtensions.cs
│ ├── BinaryDataWriterExtensions.cs
│ ├── KCL
│ │ ├── KCL.cs
│ │ ├── KCLColors.cs
│ │ ├── KCLHeader.cs
│ │ ├── KCLOctree.cs
│ │ ├── Triangle.cs
│ │ └── TriangleBoxIntersect.cs
│ ├── KCLExt.csproj
│ ├── KCLext.cs
│ ├── MaterialSetForm.Designer.cs
│ ├── MaterialSetForm.cs
│ ├── MaterialSetForm.resx
│ ├── MathUtil.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
└── SARCLib
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── SARCExt.csproj
│ ├── Sarc
│ ├── SARC.cs
│ ├── Yaz0Compression.cs
│ └── Yaz0Exception.cs
│ ├── SarcEditor.Designer.cs
│ ├── SarcEditor.cs
│ ├── SarcEditor.resx
│ ├── SarcExt.cs
│ └── packages.config
├── ModelViewer
├── ModelViewerCore.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── RendererControl.xaml
├── RendererControl.xaml.cs
├── app.config
└── packages.config
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/ScreenshotMK.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/exelix11/EditorCore/e827bf4970420b2c8e8d041dd343ec94e11fa1e6/.github/ScreenshotMK.png
--------------------------------------------------------------------------------
/.github/ScreenshotOdyssey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/exelix11/EditorCore/e827bf4970420b2c8e8d041dd343ec94e11fa1e6/.github/ScreenshotOdyssey.png
--------------------------------------------------------------------------------
/EditorCore/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | False
16 |
17 |
18 | 0.92
19 |
20 |
21 | True
22 |
23 |
24 | True
25 |
26 |
27 | False
28 |
29 |
30 | 1
31 |
32 |
33 | 2
34 |
35 |
36 | 1
37 |
38 |
39 | null
40 |
41 |
42 | True
43 |
44 |
45 | True
46 |
47 |
48 | True
49 |
50 |
51 | True
52 |
53 |
54 | 100000
55 |
56 |
57 | False
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | False
66 |
67 |
68 | 0.92
69 |
70 |
71 | True
72 |
73 |
74 | True
75 |
76 |
77 | False
78 |
79 |
80 | 1
81 |
82 |
83 | 2
84 |
85 |
86 | 1
87 |
88 |
89 | null
90 |
91 |
92 | True
93 |
94 |
95 | True
96 |
97 |
98 | True
99 |
100 |
101 | True
102 |
103 |
104 | 100000
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/EditorCore/EditorFroms/SearchResult.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace EditorCore.EditorFroms
2 | {
3 | partial class SearchResult
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.listBox1 = new System.Windows.Forms.ListBox();
32 | this.SuspendLayout();
33 | //
34 | // listBox1
35 | //
36 | this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
37 | | System.Windows.Forms.AnchorStyles.Left)
38 | | System.Windows.Forms.AnchorStyles.Right)));
39 | this.listBox1.FormattingEnabled = true;
40 | this.listBox1.Location = new System.Drawing.Point(1, 0);
41 | this.listBox1.Name = "listBox1";
42 | this.listBox1.Size = new System.Drawing.Size(243, 264);
43 | this.listBox1.TabIndex = 0;
44 | this.listBox1.DoubleClick += new System.EventHandler(this.listBox1_DoubleClick);
45 | //
46 | // SearchResult
47 | //
48 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
49 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
50 | this.ClientSize = new System.Drawing.Size(244, 266);
51 | this.Controls.Add(this.listBox1);
52 | this.MaximizeBox = false;
53 | this.Name = "SearchResult";
54 | this.Text = "SearchResult";
55 | this.Load += new System.EventHandler(this.SearchResult_Load);
56 | this.ResumeLayout(false);
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private System.Windows.Forms.ListBox listBox1;
63 | }
64 | }
--------------------------------------------------------------------------------
/EditorCore/EditorFroms/SearchResult.cs:
--------------------------------------------------------------------------------
1 | using EditorCore.Interfaces;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 |
12 | namespace EditorCore.EditorFroms
13 | {
14 | public partial class SearchResult : Form, IEditorChild
15 | {
16 | public Tuple[] SearchResultArr;
17 | public IEditorFormContext ParentEditor { get; set; }
18 |
19 | public SearchResult(Tuple[] _sr, string title, IEditorFormContext _owner)
20 | {
21 | InitializeComponent();
22 | title = "Search result: " + title;
23 | SearchResultArr = _sr;
24 | ParentEditor = _owner;
25 | }
26 |
27 | private void SearchResult_Load(object sender, EventArgs e)
28 | {
29 | foreach (var res in SearchResultArr)
30 | {
31 | listBox1.Items.Add(res.Item2.ToString() + " in " + res.Item1.name);
32 | }
33 | }
34 |
35 | private void listBox1_DoubleClick(object sender, EventArgs e)
36 | {
37 | if (listBox1.SelectedIndex >= 0)
38 | {
39 | ParentEditor.SelectObject(SearchResultArr[listBox1.SelectedIndex].Item1, SearchResultArr[listBox1.SelectedIndex].Item2);
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/EditorCore/EditorFroms/SearchResult.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/EditorCore/OtherForms/FrmCredits.cs:
--------------------------------------------------------------------------------
1 | using EditorCore.Interfaces;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 |
12 | namespace EditorCore
13 | {
14 | public partial class FrmCredits : Form
15 | {
16 | public FrmCredits(IGameModule module, ExtensionManifest[] extensions)
17 | {
18 | InitializeComponent();
19 | textBox1.Text = $"Loaded extensions:\r\nGame module : {module.ModuleName}\r\n";
20 | foreach (var ext in extensions)
21 | {
22 | textBox1.Text += $"\r\n{ext.ModuleName} by {ext.Author}\r\n";
23 | if (ext.ExtraText != null)
24 | textBox1.Text += $"{ext.ExtraText}\r\n";
25 |
26 | }
27 | }
28 |
29 | private void FrmCredits_Load(object sender, EventArgs e)
30 | {
31 | label4.Text = "V. " + Application.ProductVersion;
32 | }
33 |
34 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
35 | {
36 | System.Diagnostics.Process.Start(@"https://github.com/exelix11/OdysseyEditor");
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/EditorCore/OtherForms/GameModuleSelect.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace EditorCore.OtherForms
2 | {
3 | partial class GameModuleSelect
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.button1 = new System.Windows.Forms.Button();
32 | this.button2 = new System.Windows.Forms.Button();
33 | this.listBox1 = new System.Windows.Forms.ListBox();
34 | this.label1 = new System.Windows.Forms.Label();
35 | this.SuspendLayout();
36 | //
37 | // button1
38 | //
39 | this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
40 | this.button1.Location = new System.Drawing.Point(322, 243);
41 | this.button1.Name = "button1";
42 | this.button1.Size = new System.Drawing.Size(75, 23);
43 | this.button1.TabIndex = 0;
44 | this.button1.Text = "Cancel";
45 | this.button1.UseVisualStyleBackColor = true;
46 | this.button1.Click += new System.EventHandler(this.button1_Click);
47 | //
48 | // button2
49 | //
50 | this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
51 | this.button2.Location = new System.Drawing.Point(403, 243);
52 | this.button2.Name = "button2";
53 | this.button2.Size = new System.Drawing.Size(75, 23);
54 | this.button2.TabIndex = 1;
55 | this.button2.Text = "OK";
56 | this.button2.UseVisualStyleBackColor = true;
57 | this.button2.Click += new System.EventHandler(this.button2_Click);
58 | //
59 | // listBox1
60 | //
61 | this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
62 | | System.Windows.Forms.AnchorStyles.Left)
63 | | System.Windows.Forms.AnchorStyles.Right)));
64 | this.listBox1.FormattingEnabled = true;
65 | this.listBox1.Location = new System.Drawing.Point(3, 25);
66 | this.listBox1.Name = "listBox1";
67 | this.listBox1.Size = new System.Drawing.Size(475, 212);
68 | this.listBox1.TabIndex = 2;
69 | this.listBox1.DoubleClick += new System.EventHandler(this.listBox1_DoubleClick);
70 | //
71 | // label1
72 | //
73 | this.label1.AutoSize = true;
74 | this.label1.Location = new System.Drawing.Point(4, 7);
75 | this.label1.Name = "label1";
76 | this.label1.Size = new System.Drawing.Size(247, 13);
77 | this.label1.TabIndex = 3;
78 | this.label1.Text = "Select a game module from the loaded extensions: ";
79 | //
80 | // GameModuleSelect
81 | //
82 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
83 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
84 | this.ClientSize = new System.Drawing.Size(480, 268);
85 | this.ControlBox = false;
86 | this.Controls.Add(this.label1);
87 | this.Controls.Add(this.listBox1);
88 | this.Controls.Add(this.button2);
89 | this.Controls.Add(this.button1);
90 | this.Name = "GameModuleSelect";
91 | this.Text = "Select a Game module";
92 | this.TopMost = true;
93 | this.ResumeLayout(false);
94 | this.PerformLayout();
95 |
96 | }
97 |
98 | #endregion
99 |
100 | private System.Windows.Forms.Button button1;
101 | private System.Windows.Forms.Button button2;
102 | private System.Windows.Forms.ListBox listBox1;
103 | private System.Windows.Forms.Label label1;
104 | }
105 | }
--------------------------------------------------------------------------------
/EditorCore/OtherForms/GameModuleSelect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace EditorCore.OtherForms
12 | {
13 | public partial class GameModuleSelect : Form
14 | {
15 | public Interfaces.ExtensionManifest result = null;
16 | public GameModuleSelect(List Modules)
17 | {
18 | InitializeComponent();
19 | listBox1.Items.AddRange(Modules.ToArray());
20 | if (listBox1.Items.Count > 0)
21 | listBox1.SelectedIndex = 0;
22 | }
23 |
24 | private void button2_Click(object sender, EventArgs e)
25 | {
26 | if (listBox1.SelectedItem == null) return;
27 | result = (Interfaces.ExtensionManifest)listBox1.SelectedItem;
28 | this.Close();
29 | }
30 |
31 | private void button1_Click(object sender, EventArgs e)
32 | {
33 | result = null;
34 | this.Close();
35 | }
36 |
37 | private void listBox1_DoubleClick(object sender, EventArgs e)
38 | {
39 | if (listBox1.SelectedItem != null)
40 | button2_Click(null, null);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/EditorCore/OtherForms/GameModuleSelect.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/EditorCore/OtherForms/Settings.cs:
--------------------------------------------------------------------------------
1 | using ModelViewer;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 |
12 | namespace EditorCore
13 | {
14 | public partial class Settings : Form
15 | {
16 | List renderList = new List();
17 |
18 | public Settings()
19 | {
20 | InitializeComponent();
21 |
22 | foreach (var f in Application.OpenForms)
23 | {
24 | if (f is EditorForm)
25 | renderList.Add(((EditorForm)f).render);
26 | }
27 |
28 | }
29 |
30 | private void Settings_Load(object sender, EventArgs e)
31 | {
32 | drawDistance.Maximum = decimal.MaxValue;
33 | drawDistance.Value = double.IsInfinity(Properties.Settings.Default.FarPlaneDistance) ? 0 : (decimal)Properties.Settings.Default.FarPlaneDistance;
34 | SettingsPanel.Visible = true;
35 | CamInertiaUpDown.Value = (decimal)Properties.Settings.Default.CameraInertia;
36 | ChbFps.Checked = Properties.Settings.Default.ShowFps;
37 | ChbTriCount.Checked = Properties.Settings.Default.ShowTriCount;
38 | ChbDebugInfo.Checked = Properties.Settings.Default.ShowDbgInfo;
39 | cbCameraMode.SelectedIndex = Properties.Settings.Default.CameraMode;
40 | ZoomSenUpDown.Value = (decimal)Properties.Settings.Default.ZoomSen;
41 | RotSenUpDown.Value = (decimal)Properties.Settings.Default.RotSen;
42 | ChbStartupUpdate.Checked = Properties.Settings.Default.CheckUpdates;
43 | ChbStartupDb.Checked = Properties.Settings.Default.DownloadDb;
44 | tbUrl.Text = Properties.Settings.Default.DownloadDbLink;
45 | chbCustomModels.Checked = Properties.Settings.Default.CustomModels;
46 | SettingsPanel.Focus();
47 | }
48 |
49 | private void Form_closing(object sender, FormClosingEventArgs e)
50 | {
51 | Properties.Settings.Default.CameraInertia = (double)CamInertiaUpDown.Value;
52 | Properties.Settings.Default.ShowFps = ChbFps.Checked;
53 | Properties.Settings.Default.ShowTriCount = ChbTriCount.Checked;
54 | Properties.Settings.Default.ShowDbgInfo = ChbDebugInfo.Checked;
55 | Properties.Settings.Default.CameraMode = cbCameraMode.SelectedIndex;
56 | Properties.Settings.Default.ZoomSen = (double)ZoomSenUpDown.Value;
57 | Properties.Settings.Default.RotSen = (double)RotSenUpDown.Value;
58 | Properties.Settings.Default.FarPlaneDistance = drawDistance.Value == 0 ? double.PositiveInfinity : (double)drawDistance.Value;
59 | Properties.Settings.Default.CheckUpdates = ChbStartupUpdate.Checked;
60 | Properties.Settings.Default.DownloadDb = ChbStartupDb.Checked;
61 | Properties.Settings.Default.DownloadDbLink = tbUrl.Text;
62 | Properties.Settings.Default.CustomModels = chbCustomModels.Checked;
63 | Properties.Settings.Default.Save();
64 |
65 | foreach (var render in renderList)
66 | {
67 | render.CameraInertiaFactor = (double)CamInertiaUpDown.Value;
68 | render.ShowFps = ChbFps.Checked;
69 | render.ShowTriangleCount = ChbTriCount.Checked;
70 | render.ShowDebugInfo = ChbDebugInfo.Checked;
71 | render.CamMode = cbCameraMode.SelectedIndex == 0 ? HelixToolkit.Wpf.CameraMode.Inspect : HelixToolkit.Wpf.CameraMode.WalkAround;
72 | render.ZoomSensitivity = (double)ZoomSenUpDown.Value;
73 | render.RotationSensitivity = (double)RotSenUpDown.Value;
74 | render.FarPlaneDistance = Properties.Settings.Default.FarPlaneDistance;
75 | }
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/EditorCore/OtherForms/Settings.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/EditorCore/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 | using System.IO;
7 | using EditorCore.Interfaces;
8 | using EditorCoreCommon;
9 |
10 | namespace EditorCore
11 | {
12 | static class Program
13 | {
14 | ///
15 | /// Punto di ingresso principale dell'applicazione.
16 | ///
17 | [STAThread]
18 | static void Main(string[] args)
19 | {
20 | System.IO.Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
21 | System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
22 | System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;
23 |
24 | Application.EnableVisualStyles();
25 | Application.SetCompatibleTextRenderingDefault(false);
26 |
27 | if (Properties.Settings.Default.UpgradeSettings)
28 | {
29 | Properties.Settings.Default.Upgrade();
30 | Properties.Settings.Default.UpgradeSettings = false;
31 | Properties.Settings.Default.Save();
32 | }
33 |
34 | string[] ExtDlls = Directory.GetFiles("Ext", "*Ext.dll");
35 | List extensions = new List();
36 | foreach (string file in ExtDlls)
37 | {
38 | System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(file);
39 | foreach (Type type in assembly.GetTypes())
40 | {
41 | Type typeExample = type.GetInterface("ExtensionManifest");
42 | if (typeExample == null) continue;
43 |
44 | var ext = assembly.CreateInstance(type.FullName) as ExtensionManifest;
45 | if (ext != null)
46 | {
47 | extensions.Add(ext);
48 | if (ext.Handlers != null)
49 | OpenFileHandler.handlers.AddRange(ext.Handlers);
50 | }
51 | }
52 | }
53 |
54 | if (Properties.Settings.Default.CheckUpdates)
55 | foreach (var m in extensions) m.CheckForUpdates();
56 |
57 | var firstForm = new EditorForm(args, extensions.ToArray());
58 | firstForm.Show();
59 |
60 | Timer ApplicationExitCheck = new Timer()
61 | {
62 | Enabled = true,
63 | Interval = 30000,
64 | };
65 | ApplicationExitCheck.Tick += delegate (object sender, EventArgs e) { CheckForExit(); };
66 | ApplicationExitCheck.Start(); //This is needed because closing every form won't close the application
67 |
68 | Application.Run();
69 | }
70 |
71 | public static void CheckForExit()
72 | {
73 | if (Application.OpenForms.Count == 0)
74 | Application.Exit();//Environment.Exit(0);
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/EditorCore/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Le informazioni generali relative a un assembly sono controllate dal seguente
6 | // set di attributi. Modificare i valori di questi attributi per modificare le informazioni
7 | // associate a un assembly.
8 | [assembly: AssemblyTitle("EditorCore")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Exelix")]
12 | [assembly: AssemblyProduct("EditorCore")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
18 | // ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
19 | // COM, impostare su true l'attributo ComVisible per tale tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
23 | [assembly: Guid("df37f616-9cb6-4594-b30a-d5dd52ee1b3e")]
24 |
25 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
26 | //
27 | // Versione principale
28 | // Versione secondaria
29 | // Numero di build
30 | // Revisione
31 | //
32 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
33 | // usando l'asterisco '*' come illustrato di seguito:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.1.0")]
36 | [assembly: AssemblyFileVersion("1.1.0.0")]
37 |
--------------------------------------------------------------------------------
/EditorCore/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Il codice è stato generato da uno strumento.
4 | // Versione runtime:4.0.30319.42000
5 | //
6 | // Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
7 | // il codice viene rigenerato.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace EditorCore.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
17 | ///
18 | // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder.
19 | // tramite uno strumento quale ResGen o Visual Studio.
20 | // Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen
21 | // con l'opzione /str oppure ricompilare il progetto VS.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EditorCore.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le
51 | /// ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/EditorCore/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/EditorCore/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | False
7 |
8 |
9 | 0.92
10 |
11 |
12 | True
13 |
14 |
15 | True
16 |
17 |
18 | False
19 |
20 |
21 | 1
22 |
23 |
24 | 2
25 |
26 |
27 | 1
28 |
29 |
30 | null
31 |
32 |
33 | True
34 |
35 |
36 | True
37 |
38 |
39 | True
40 |
41 |
42 | True
43 |
44 |
45 | 100000
46 |
47 |
48 | False
49 |
50 |
51 |
--------------------------------------------------------------------------------
/EditorCore/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/EditorCoreCommon/EditorCoreCommon.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {EE9882D0-F7A7-45E1-971A-1527B7E399F5}
8 | Library
9 | Properties
10 | EditorCoreCommon
11 | EditorCoreCommon
12 | v4.5.2
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 | ..\packages\Octokit.0.31.0\lib\net45\Octokit.dll
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | Form
55 |
56 |
57 | AddBymlPropertyDialog.cs
58 |
59 |
60 | Form
61 |
62 |
63 | LoadingForm.cs
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | AddBymlPropertyDialog.cs
82 |
83 |
84 | LoadingForm.cs
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Forms/AddBymlPropertyDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace EditorCore
12 | {
13 | public partial class AddBymlPropertyDialog : Form
14 | {
15 | dynamic result = null;
16 | AddBymlPropertyDialog()
17 | {
18 | InitializeComponent();
19 | }
20 |
21 | private void AddPropertyDialog_Load(object sender, EventArgs e)
22 | {
23 | comboBox1.Items.AddRange(ByamlTypeHelper.StringToNodeTable.Keys.ToArray());
24 | comboBox1.Items.Add(typeof(Dictionary));
25 | comboBox1.Items.Add(typeof(List));
26 | }
27 |
28 | public static Tuple newProperty(bool enableName)
29 | {
30 | var dialog = new AddBymlPropertyDialog();
31 | dialog.textBox5.Enabled = enableName;
32 | dialog.ShowDialog();
33 | return dialog.result;
34 | }
35 |
36 | private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
37 | {
38 | if ((Type)comboBox1.SelectedItem == typeof(List) ||
39 | (Type)comboBox1.SelectedItem == typeof(Dictionary))
40 | textBox1.Enabled = false;
41 | else
42 | textBox1.Enabled = true;
43 | }
44 |
45 | private void radioButton1_CheckedChanged(object sender, EventArgs e)
46 | {
47 | panel1.Enabled = !radioButton1.Checked;
48 | panel2.Enabled = radioButton1.Checked;
49 | }
50 |
51 | private void button2_Click(object sender, EventArgs e)
52 | {
53 | result = null;
54 | this.Close();
55 | }
56 |
57 | private void button1_Click(object sender, EventArgs e)
58 | {
59 | dynamic value;
60 | if (radioButton1.Checked)
61 | {
62 | if ((Type)comboBox1.SelectedItem == typeof(List)) value = new List();
63 | else if ((Type)comboBox1.SelectedItem == typeof(Dictionary)) value = new Dictionary();
64 | else
65 | {
66 | value = ByamlTypeHelper.ConvertValue((Type)comboBox1.SelectedItem, textBox1.Text);
67 | }
68 | }
69 | else
70 | {
71 | value = new Dictionary();
72 | value.Add("X",float.Parse(textBox2.Text));
73 | value.Add("Y", float.Parse(textBox3.Text));
74 | value.Add("Z", float.Parse(textBox4.Text));
75 | }
76 | result = new Tuple(textBox5.Enabled ? textBox5.Text : null, value);
77 | this.Close();
78 | }
79 | }
80 |
81 | public static class ByamlTypeHelper
82 | {
83 | public delegate dynamic ConvertMethod(string inString);
84 | public static readonly Dictionary StringToNodeTable = new Dictionary()
85 | {
86 | { typeof(string) , (s) => s },
87 | { typeof(int) , (s) => (int.Parse(s)) },
88 | { typeof(uint) , (s) =>(uint.Parse(s)) },
89 | { typeof(long) , (s) => (long.Parse(s)) },
90 | { typeof(ulong) , (s) => (ulong.Parse(s)) },
91 | { typeof(double) , (s) =>(double.Parse(s)) },
92 | { typeof(float) , (s) => (float.Parse(s)) },
93 | { typeof(bool) , (s) => (bool.Parse(s)) },
94 | };
95 | public static dynamic ConvertValue(Type t, string value) => StringToNodeTable[t](value);
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Forms/AddBymlPropertyDialog.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Forms/LoadingForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace EditorCore.EditorFroms
2 | {
3 | partial class LoadingForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.SuspendLayout();
33 | //
34 | // label1
35 | //
36 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
37 | this.label1.Location = new System.Drawing.Point(2, 32);
38 | this.label1.Name = "label1";
39 | this.label1.Size = new System.Drawing.Size(341, 88);
40 | this.label1.TabIndex = 0;
41 | this.label1.Text = "Loading....";
42 | this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
43 | this.label1.UseWaitCursor = true;
44 | //
45 | // LoadingForm
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.BackColor = System.Drawing.SystemColors.ControlDark;
50 | this.ClientSize = new System.Drawing.Size(346, 153);
51 | this.Controls.Add(this.label1);
52 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
53 | this.Name = "LoadingForm";
54 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
55 | this.Text = "LoadingForm";
56 | this.UseWaitCursor = true;
57 | this.ResumeLayout(false);
58 |
59 | }
60 |
61 | #endregion
62 |
63 | private System.Windows.Forms.Label label1;
64 | }
65 | }
--------------------------------------------------------------------------------
/EditorCoreCommon/Forms/LoadingForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Diagnostics;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 |
12 | namespace EditorCore.EditorFroms
13 | {
14 | public partial class LoadingForm : Form
15 | {
16 | public static LoadingForm LoadingFormInstance;
17 |
18 | public static void ShowLoading(Form owner, string text = "Loading...")
19 | {
20 | if (LoadingFormInstance != null)
21 | return;
22 | LoadingFormInstance = new LoadingForm();
23 | LoadingFormInstance.Show(owner);
24 | LoadingFormInstance.label1.Text = text;
25 | LoadingFormInstance.Focus();
26 | LoadingFormInstance.Refresh();
27 | }
28 |
29 | public static void EndLoading()
30 | {
31 | if (LoadingFormInstance == null) return;
32 | LoadingFormInstance.Close();
33 | LoadingFormInstance = null;
34 | }
35 |
36 | public LoadingForm()
37 | {
38 | InitializeComponent();
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Forms/LoadingForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Interfaces/EditorChild.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EditorCore.Interfaces
8 | {
9 | public interface IEditorChild
10 | {
11 | IEditorFormContext ParentEditor { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Interfaces/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 |
9 | namespace EditorCore.Interfaces
10 | {
11 | public interface ExtensionManifest
12 | {
13 | string ModuleName { get; }
14 | string Author { get; }
15 | string ExtraText { get; }
16 |
17 | bool HasGameModule { get; }
18 | IGameModule GetNewGameModule();
19 |
20 | //MenuExt and Handlers should be only instantiated once to save memory
21 | IMenuExtension MenuExt { get; }
22 | IFileHander[] Handlers { get; }
23 |
24 | void CheckForUpdates();
25 | }
26 |
27 | public interface IMenuExtension
28 | {
29 | ToolStripMenuItem[] FileMenuExtensions { get; }
30 | ToolStripMenuItem[] ToolsMenuExtensions { get; }
31 | ToolStripMenuItem[] TitleBarExtensions { get; }
32 | }
33 |
34 | //public interface IClipboardExtension
35 | //{
36 | // ToolStripMenuItem[] CopyExtensions { get; }
37 | // ToolStripMenuItem[] PasteExtensions { get; }
38 | //}
39 |
40 | public interface IFileHander
41 | {
42 | string HandlerName { get; }
43 | bool IsFormatSupported(string filename, Stream file);
44 | void OpenFile(string filename, Stream file);
45 | }
46 |
47 | public interface IEditableFileHandler : IFileHander
48 | {
49 | void OpenFileEdit(string filename, Stream file, Stream saveStream);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Interfaces/IGameSpecificModule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 | using System.Windows.Media.Media3D;
9 |
10 | namespace EditorCore.Interfaces
11 | {
12 | public interface IEditorFormContext
13 | {
14 | ILevel LoadedLevel { get; }
15 | IObjList CurList { get; }
16 | ILevelObj SelectedObj { get; set; }
17 | ILevelObj[] SelectedObjs { get; }
18 | string GameFolder { get; set; }
19 |
20 | void RegisterClipBoardExt(ToolStripMenuItem item);
21 | void RegisterMenuStripExt(ToolStripMenuItem item);
22 | void RegisterMenuExtension(IMenuExtension ext);
23 | void LoadLevel(string path);
24 | void LoadLevel(ILevel lev);
25 |
26 | void SelectObject(IObjList List, ILevelObj obj);
27 | void EditPath(IPathObj path);
28 | void EditList(IObjList objlist);
29 | void EditList(IList objList);
30 | void AddToUndo(Action act, string desc, dynamic arg = null);
31 | void AddObj(ILevelObj o, IObjList list);
32 | void DeleteObj(ILevelObj o, IObjList list);
33 |
34 | void AddModelObj(string path, object reference, Vector3D Pos, Vector3D Scale, Vector3D Rot);
35 |
36 | IEditorFormContext NewInstance(params string[] args);
37 | }
38 |
39 | public interface IGameModule
40 | {
41 | string ModuleName {get;}
42 | string ModelsFolder { get; }
43 |
44 | Tuple[] GetClassConverters { get; }
45 |
46 | string[] ReservedPropNames { get; }
47 | string[] ModelFieldPropNames { get; }
48 |
49 | bool IsAddListSupported { get; }
50 | bool IsPropertyEditingSupported { get; }
51 | IEditorFormContext ViewForm { get; set; }
52 |
53 | string[] AutoHideList { get; }
54 |
55 | void InitModule(IEditorFormContext currentView);
56 | void FormLoaded(); //for startup checks
57 | void ParseArgs(string[] Args);
58 |
59 | ILevel LoadLevel(string path = null);
60 | ILevel NewLevel(string path = null);
61 | IObjList CreateObjList(string name, IList baseList);
62 | ILevelObj NewObject();
63 |
64 | void SaveLevel(ILevel level);
65 | void SaveLevelAs(ILevel level);
66 |
67 | bool ConvertModelFile(string ObjName, string path);
68 | string GetPlaceholderModel(string ObjName, string ListName);
69 |
70 | bool OpenLevelFile(string name, Stream file); //if it fails the editor will try using OpenFileHandler
71 | string AddObjList(ILevel level);
72 | void EditChildrenNode(ILevelObj obj);
73 |
74 | Tuple GetNewProperty(dynamic target);
75 | }
76 |
77 | public interface IEditingOptionsModule
78 | {
79 | void InitOptionsMenu(ref ContextMenuStrip baseMenu);
80 | void OptionsMenuOpening(ILevelObj clickedObj);
81 | }
82 |
83 | public interface IActionButtonsModule
84 | {
85 | void InitActionButtons(ref ToolStrip baseButtonStrip);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Interfaces/ILevel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace EditorCore.Interfaces
8 | {
9 | public interface IObjList : IList
10 | {
11 | bool IsHidden { get; set; }
12 | bool ReadOnly { get; }
13 | string name { get; set; }
14 |
15 | void ApplyChanges();
16 | }
17 |
18 | public interface ILevel
19 | {
20 | Dictionary LevelFiles { get; set; }
21 | Dictionary objs { get; set; }
22 | dynamic LoadedLevelData { get; set; }
23 | string FilePath { get; set; }
24 | int HighestID { get; set; }
25 |
26 | bool HasList(string name);
27 | IObjList FindListByObj(ILevelObj o);
28 | }
29 |
30 | public struct SearchResult
31 | {
32 | public ILevelObj obj;
33 | public int Index;
34 | public string ListName;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Interfaces/ILevelObj.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Media.Media3D;
8 | using static EditorCore.PropertyGridTypes;
9 |
10 | namespace EditorCore.Interfaces
11 | {
12 | public struct Transform
13 | {
14 | public Vector3D Pos, Rot, Scale;
15 | }
16 |
17 | public interface ILevelObj : ICloneable
18 | {
19 | [Browsable(false)]
20 | bool ReadOnly { get; set; } //if this object is not actually part of the level, it can't be selected nor dragged
21 |
22 | [TypeConverter(typeof(DictionaryConverter))]
23 | Dictionary Prop { get; set; }
24 |
25 | dynamic this[string name] { get; set; }
26 | Vector3D Pos { get; set; }
27 | Vector3D Rot { get; set; }
28 | Vector3D Scale { get; set; }
29 | string ID { get; set; }
30 | string ModelName { get; }
31 | string Name { get; set; }
32 |
33 | [Browsable(false)]
34 | int ID_int { get; set; }
35 | [Browsable(false)]
36 | Vector3D ModelView_Pos { get; set; }
37 | [Browsable(false)]
38 | Vector3D ModelView_Rot { get; }
39 | [Browsable(false)]
40 | Vector3D ModelView_Scale { get; }
41 |
42 | [Browsable(false)]
43 | Transform transform { get; set; }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Interfaces/IPathObj.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Media.Media3D;
7 |
8 | namespace EditorCore.Interfaces
9 | {
10 | public interface IPathObj : ILevelObj, IObjList
11 | {
12 | Point3D[] Points { get; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/EditorCoreCommon/OpenFileHandler.cs:
--------------------------------------------------------------------------------
1 | using EditorCore.Interfaces;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace EditorCoreCommon
10 | {
11 | public static class OpenFileHandler
12 | {
13 | public static List handlers = new List();
14 |
15 | public static void OpenFile(string filename, Stream FileStream, int BasePositionInStream = 0)
16 | {
17 | foreach (var h in handlers)
18 | {
19 | FileStream.Position = BasePositionInStream;
20 | if (h.IsFormatSupported(filename, FileStream))
21 | {
22 | FileStream.Position = BasePositionInStream;
23 | h.OpenFile(filename, FileStream);
24 | break;
25 | }
26 | }
27 | }
28 |
29 | public static void OpenFileEditable(string filename, Stream FileStream, Stream SaveStream, int BasePositionInStream = 0)
30 | {
31 | foreach (var h in handlers)
32 | {
33 | FileStream.Position = BasePositionInStream;
34 | if (h.IsFormatSupported(filename, FileStream))
35 | {
36 | FileStream.Position = BasePositionInStream;
37 | if (h is IEditableFileHandler)
38 | ((IEditableFileHandler)h).OpenFileEdit(filename, FileStream, SaveStream);
39 | else
40 | h.OpenFile(filename, FileStream);
41 | break;
42 | }
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/EditorCoreCommon/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Le informazioni generali relative a un assembly sono controllate dal seguente
6 | // set di attributi. Modificare i valori di questi attributi per modificare le informazioni
7 | // associate a un assembly.
8 | [assembly: AssemblyTitle("EditorCoreCommon")]
9 | [assembly: AssemblyDescription("Common functions and interfaces for EditorCore")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("EditorCoreCommon")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
18 | // ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
19 | // COM, impostare su true l'attributo ComVisible per tale tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
23 | [assembly: Guid("ee9882d0-f7a7-45e1-971a-1527b7e399f5")]
24 |
25 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
26 | //
27 | // Versione principale
28 | // Versione secondaria
29 | // Numero di build
30 | // Revisione
31 | //
32 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
33 | // usando l'asterisco '*' come illustrato di seguito:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/EditorCoreCommon/UpdateCheck.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 |
8 | namespace EditorCore
9 | {
10 | public class GitHubUpdateCheck
11 | {
12 | public class GitHubRelease
13 | {
14 | public DateTimeOffset CreatedAt { get; protected set; }
15 | public string Body { get; protected set; }
16 | public string Name { get; protected set; }
17 | public string TargetCommitish { get; protected set; }
18 | public string TagName { get; protected set; }
19 | public int Id { get; protected set; }
20 | public string Url { get; protected set; }
21 |
22 | public int Index { get; protected set; }
23 |
24 | internal GitHubRelease(Octokit.Release release, int index)
25 | {
26 | CreatedAt = release.CreatedAt;
27 | Body = release.Body;
28 | Name = release.Name;
29 | TargetCommitish = release.TargetCommitish;
30 | TagName = release.TagName;
31 | Id = release.Id;
32 | Url = release.Url;
33 | Index = index;
34 | }
35 | }
36 |
37 | public static async Task CheckForUpdates(string owner, string name)
38 | {
39 | try
40 | {
41 | var githubClient = new Octokit.GitHubClient(new Octokit.ProductHeaderValue("EditorCore"));
42 | var ver = await githubClient.Repository.Release.GetAll(owner, name);
43 | return new GitHubRelease(ver[ver.Count - 1], ver.Count - 1);
44 | }
45 | catch
46 | {
47 | return null;
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/EditorCoreCommon/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BfresLib/BfresLib.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {9313D751-0D97-4621-B6E2-783E6986A118}
8 | Library
9 | Properties
10 | BfresLib
11 | BfresLib
12 | v4.5.2
13 | 512
14 |
15 |
16 |
17 |
18 |
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | {9675f3de-df52-4750-9222-ba7707f1566e}
57 | BnTxx
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BfresLib/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Le informazioni generali relative a un assembly sono controllate dal seguente
6 | // set di attributi. Modificare i valori di questi attributi per modificare le informazioni
7 | // associate a un assembly.
8 | [assembly: AssemblyTitle("BfresLib")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("BfresLib")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
18 | // ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
19 | // COM, impostare su true l'attributo ComVisible per tale tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
23 | [assembly: Guid("9313d751-0d97-4621-b6e2-783e6986a118")]
24 |
25 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
26 | //
27 | // Versione principale
28 | // Versione secondaria
29 | // Numero di build
30 | // Revisione
31 | //
32 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
33 | // usando l'asterisco '*' come illustrato di seguito:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BfresLib/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/ASTC.cs:
--------------------------------------------------------------------------------
1 | using BnTxx.Formats;
2 | using System;
3 | using System.IO;
4 |
5 | namespace BnTxx
6 | {
7 | static class ASTC
8 | {
9 | public static byte[] UnswizzleASTC(Texture Tex, int BlkWidth, int BlkHeight)
10 | {
11 | int W = (Tex.Width + BlkWidth - 1) / BlkWidth;
12 | int H = (Tex.Height + BlkHeight - 1) / BlkHeight;
13 |
14 | byte[] Output = new byte[W * H * 16];
15 |
16 | ISwizzle Swizzle = Tex.GetSwizzle();
17 |
18 | int OOffset = 0;
19 |
20 | for (int Y = 0; Y < H; Y++)
21 | {
22 | for (int X = 0; X < W; X++)
23 | {
24 | int Offset = Swizzle.GetSwizzleOffset(X, Y);
25 |
26 | Buffer.BlockCopy(Tex.Data, Offset, Output, OOffset, 16);
27 |
28 | OOffset += 16;
29 | }
30 | }
31 |
32 | return Output;
33 | }
34 |
35 | public static void Save(Texture Tex, string FileName)
36 | {
37 | int BW = 0, BH = 0;
38 |
39 | switch (Tex.FormatType)
40 | {
41 | case TextureFormatType.ASTC4x4: BW = 4; BH = 4; break;
42 | case TextureFormatType.ASTC5x4: BW = 5; BH = 4; break;
43 | case TextureFormatType.ASTC5x5: BW = 5; BH = 5; break;
44 | case TextureFormatType.ASTC6x5: BW = 6; BH = 5; break;
45 | case TextureFormatType.ASTC6x6: BW = 6; BH = 6; break;
46 | case TextureFormatType.ASTC8x5: BW = 8; BH = 5; break;
47 | case TextureFormatType.ASTC8x6: BW = 8; BH = 6; break;
48 | case TextureFormatType.ASTC8x8: BW = 8; BH = 8; break;
49 | case TextureFormatType.ASTC10x5: BW = 10; BH = 5; break;
50 | case TextureFormatType.ASTC10x6: BW = 10; BH = 6; break;
51 | case TextureFormatType.ASTC10x8: BW = 10; BH = 8; break;
52 | case TextureFormatType.ASTC10x10: BW = 10; BH = 10; break;
53 | case TextureFormatType.ASTC12x10: BW = 12; BH = 10; break;
54 | case TextureFormatType.ASTC12x12: BW = 12; BH = 12; break;
55 | }
56 |
57 | byte[] Data = UnswizzleASTC(Tex, BW, BH);
58 |
59 | using (FileStream ASTCFile = new FileStream(FileName, FileMode.Create))
60 | {
61 | BinaryWriter Writer = new BinaryWriter(ASTCFile);
62 |
63 | int BZ = 1, Tex3DDepthZ = 1; //Should be > 1 for 3D textures only
64 |
65 | Writer.Write(0x5ca1ab13u);
66 | Writer.Write((byte)BW);
67 | Writer.Write((byte)BH);
68 | Writer.Write((byte)BZ);
69 | Writer.Write((byte)(Tex.Width >> 0));
70 | Writer.Write((byte)(Tex.Width >> 8));
71 | Writer.Write((byte)(Tex.Width >> 16));
72 | Writer.Write((byte)(Tex.Height >> 0));
73 | Writer.Write((byte)(Tex.Height >> 8));
74 | Writer.Write((byte)(Tex.Height >> 16));
75 | Writer.Write((byte)(Tex3DDepthZ >> 0));
76 | Writer.Write((byte)(Tex3DDepthZ >> 8));
77 | Writer.Write((byte)(Tex3DDepthZ >> 16));
78 |
79 | Writer.Write(Data);
80 | }
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/BlockLinearSwizzle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace BnTxx
4 | {
5 | class BlockLinearSwizzle : ISwizzle
6 | {
7 | private int BhShift;
8 | private int BppShift;
9 | private int BhMask;
10 |
11 | private int XShift;
12 | private int GobStride;
13 |
14 | public BlockLinearSwizzle(int Width, int Bpp, int BlockHeight = 16)
15 | {
16 | BhMask = (BlockHeight * 8) - 1;
17 |
18 | BhShift = CountLsbZeros(BlockHeight * 8);
19 | BppShift = CountLsbZeros(Bpp);
20 |
21 | int WidthInGobs = (int)Math.Ceiling(Width * Bpp / 64f);
22 |
23 | GobStride = 512 * BlockHeight * WidthInGobs;
24 |
25 | XShift = CountLsbZeros(512 * BlockHeight);
26 | }
27 |
28 | private int CountLsbZeros(int Value)
29 | {
30 | int Count = 0;
31 |
32 | while (((Value >> Count) & 1) == 0)
33 | {
34 | Count++;
35 | }
36 |
37 | return Count;
38 | }
39 |
40 | public int GetSwizzleOffset(int X, int Y)
41 | {
42 | X <<= BppShift;
43 |
44 | int Position = (Y >> BhShift) * GobStride;
45 |
46 | Position += (X >> 6) << XShift;
47 |
48 | Position += ((Y & BhMask) >> 3) << 9;
49 |
50 | Position += ((X & 0x3f) >> 5) << 8;
51 | Position += ((Y & 0x07) >> 1) << 6;
52 | Position += ((X & 0x1f) >> 4) << 5;
53 | Position += ((Y & 0x01) >> 0) << 4;
54 | Position += ((X & 0x0f) >> 0) << 0;
55 |
56 | return Position;
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/BnTxx.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {9675F3DE-DF52-4750-9222-BA7707F1566E}
8 | Library
9 | BnTxx
10 | BnTxx
11 | v4.5.2
12 | 512
13 | true
14 |
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Formats/ChannelType.cs:
--------------------------------------------------------------------------------
1 | namespace BnTxx.Formats
2 | {
3 | public enum ChannelType
4 | {
5 | Zero,
6 | One,
7 | Red,
8 | Green,
9 | Blue,
10 | Alpha
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Formats/InvalidSignatureException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace BnTxx.Formats
4 | {
5 | class InvalidSignatureException : Exception
6 | {
7 | private const string ExMsg = "Invalid signature! Expected \"{0}\", found \"{1}\"!";
8 |
9 | public InvalidSignatureException() : base() { }
10 |
11 | public InvalidSignatureException(string message) : base(message) { }
12 |
13 | public InvalidSignatureException(string Expected, string Found) : this(string.Format(ExMsg, Expected, Found)) { }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Formats/PatriciaTree.cs:
--------------------------------------------------------------------------------
1 | using BnTxx.Utilities;
2 | using System.Collections.Generic;
3 | using System.Collections;
4 | using System.IO;
5 |
6 | namespace BnTxx.Formats
7 | {
8 | class PatriciaTree : IEnumerable
9 | {
10 | private List Nodes;
11 |
12 | private List Names;
13 |
14 | public int Count { get { return Names.Count; } }
15 |
16 | public PatriciaTree()
17 | {
18 | Nodes = new List { new PatriciaTreeNode() };
19 |
20 | Names = new List();
21 | }
22 |
23 | public PatriciaTree(BinaryReader Reader) : this()
24 | {
25 | string DictSignature = Reader.ReadString(4);
26 |
27 | if (DictSignature != "_DIC")
28 | {
29 | throw new InvalidSignatureException("_DIC", DictSignature);
30 | }
31 |
32 | Nodes.Clear();
33 |
34 | int NodesCount = Reader.ReadInt32();
35 |
36 | long Position = Reader.BaseStream.Position;
37 |
38 | for (int Index = 0; Index < NodesCount + 1; Index++)
39 | {
40 | Reader.BaseStream.Seek(Position + Index * 0x10, SeekOrigin.Begin);
41 |
42 | uint ReferenceBit = Reader.ReadUInt32();
43 | ushort LeftNodeIndex = Reader.ReadUInt16();
44 | ushort RightNodeIndex = Reader.ReadUInt16();
45 | int NameAddress = Reader.ReadInt32();
46 | int DataAddress = Reader.ReadInt32(); //Uninitialized?
47 |
48 | Reader.BaseStream.Seek(NameAddress, SeekOrigin.Begin);
49 |
50 | string Name = Reader.ReadShortString();
51 |
52 | Nodes.Add(new PatriciaTreeNode()
53 | {
54 | ReferenceBit = ReferenceBit,
55 | LeftNodeIndex = LeftNodeIndex,
56 | RightNodeIndex = RightNodeIndex,
57 | Name = Name
58 | });
59 |
60 | if (Index > 0)
61 | {
62 | Names.Add(Name);
63 | }
64 | }
65 | }
66 |
67 | public IEnumerator GetEnumerator()
68 | {
69 | return Names.GetEnumerator();
70 | }
71 |
72 | IEnumerator IEnumerable.GetEnumerator()
73 | {
74 | return GetEnumerator();
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Formats/PatriciaTreeNode.cs:
--------------------------------------------------------------------------------
1 | namespace BnTxx.Formats
2 | {
3 | class PatriciaTreeNode
4 | {
5 | public uint ReferenceBit { get; set; }
6 | public ushort LeftNodeIndex { get; set; }
7 | public ushort RightNodeIndex { get; set; }
8 | public string Name { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Formats/Texture.cs:
--------------------------------------------------------------------------------
1 | using BnTxx.Utilities;
2 |
3 | using System;
4 |
5 | namespace BnTxx.Formats
6 | {
7 | public struct Texture
8 | {
9 | public string Name;
10 |
11 | public int Width;
12 | public int Height;
13 | public int ArrayCount;
14 | public int BlockHeightLog2;
15 | public int MipmapCount;
16 |
17 | public long[] MipOffsets;
18 |
19 | public byte[] Data;
20 |
21 | public ChannelType Channel0Type;
22 | public ChannelType Channel1Type;
23 | public ChannelType Channel2Type;
24 | public ChannelType Channel3Type;
25 |
26 | public TextureType Type;
27 | public TextureFormatType FormatType;
28 | public TextureFormatVar FormatVariant;
29 |
30 | public ISwizzle GetSwizzle()
31 | {
32 | return new BlockLinearSwizzle(
33 | GetWidthInTexels(),
34 | GetBytesPerTexel(),
35 | GetBlockHeight());
36 | }
37 |
38 | public int GetWidthInTexels()
39 | {
40 | switch (FormatType)
41 | {
42 | case TextureFormatType.BC1:
43 | case TextureFormatType.BC2:
44 | case TextureFormatType.BC3:
45 | case TextureFormatType.BC4:
46 | case TextureFormatType.BC5:
47 | case TextureFormatType.ASTC4x4:
48 | return (Width + 3) / 4;
49 |
50 | case TextureFormatType.ASTC5x4:
51 | case TextureFormatType.ASTC5x5:
52 | return (Width + 4) / 5;
53 |
54 | case TextureFormatType.ASTC6x5:
55 | case TextureFormatType.ASTC6x6:
56 | return (Width + 5) / 6;
57 |
58 | case TextureFormatType.ASTC8x5:
59 | case TextureFormatType.ASTC8x6:
60 | case TextureFormatType.ASTC8x8:
61 | return (Width + 7) / 8;
62 |
63 | case TextureFormatType.ASTC10x5:
64 | case TextureFormatType.ASTC10x6:
65 | case TextureFormatType.ASTC10x8:
66 | case TextureFormatType.ASTC10x10:
67 | return (Width + 9) / 10;
68 |
69 | case TextureFormatType.ASTC12x10:
70 | case TextureFormatType.ASTC12x12:
71 | return (Width + 11) / 12;
72 | }
73 |
74 | return Width;
75 | }
76 |
77 | public int GetPow2HeightInTexels()
78 | {
79 | int Pow2Height = BitUtils.Pow2RoundUp(Height);
80 |
81 | switch (FormatType)
82 | {
83 | case TextureFormatType.BC1:
84 | case TextureFormatType.BC2:
85 | case TextureFormatType.BC3:
86 | case TextureFormatType.BC4:
87 | case TextureFormatType.BC5:
88 | case TextureFormatType.ASTC4x4:
89 | case TextureFormatType.ASTC5x4:
90 | return (Pow2Height + 3) / 4;
91 |
92 | case TextureFormatType.ASTC5x5:
93 | case TextureFormatType.ASTC6x5:
94 | case TextureFormatType.ASTC8x5:
95 | return (Pow2Height + 4) / 5;
96 |
97 | case TextureFormatType.ASTC6x6:
98 | case TextureFormatType.ASTC8x6:
99 | case TextureFormatType.ASTC10x6:
100 | return (Pow2Height + 5) / 6;
101 |
102 | case TextureFormatType.ASTC8x8:
103 | case TextureFormatType.ASTC10x8:
104 | return (Pow2Height + 7) / 8;
105 |
106 | case TextureFormatType.ASTC10x10:
107 | case TextureFormatType.ASTC12x10:
108 | return (Pow2Height + 9) / 10;
109 |
110 | case TextureFormatType.ASTC12x12:
111 | return (Pow2Height + 11) / 12;
112 | }
113 |
114 | return Pow2Height;
115 | }
116 |
117 | public int GetBytesPerTexel()
118 | {
119 | switch (FormatType)
120 | {
121 | case TextureFormatType.R5G6B5:
122 | case TextureFormatType.R8G8:
123 | case TextureFormatType.R16:
124 | return 2;
125 |
126 | case TextureFormatType.R8G8B8A8:
127 | case TextureFormatType.R11G11B10:
128 | case TextureFormatType.R32:
129 | return 4;
130 |
131 | case TextureFormatType.BC1:
132 | case TextureFormatType.BC4:
133 | return 8;
134 |
135 | case TextureFormatType.BC2:
136 | case TextureFormatType.BC3:
137 | case TextureFormatType.BC5:
138 | case TextureFormatType.ASTC4x4:
139 | case TextureFormatType.ASTC5x4:
140 | case TextureFormatType.ASTC5x5:
141 | case TextureFormatType.ASTC6x5:
142 | case TextureFormatType.ASTC6x6:
143 | case TextureFormatType.ASTC8x5:
144 | case TextureFormatType.ASTC8x6:
145 | case TextureFormatType.ASTC8x8:
146 | case TextureFormatType.ASTC10x5:
147 | case TextureFormatType.ASTC10x6:
148 | case TextureFormatType.ASTC10x8:
149 | case TextureFormatType.ASTC10x10:
150 | case TextureFormatType.ASTC12x10:
151 | case TextureFormatType.ASTC12x12:
152 | return 16;
153 | }
154 |
155 | throw new NotImplementedException();
156 | }
157 |
158 | public int GetBlockHeight()
159 | {
160 | return 1 << BlockHeightLog2;
161 | }
162 |
163 | public override string ToString()
164 | {
165 | return Name;
166 | }
167 |
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Formats/TextureFormatType.cs:
--------------------------------------------------------------------------------
1 | namespace BnTxx.Formats
2 | {
3 | public enum TextureFormatType
4 | {
5 | R5G6B5 = 0x07,
6 | R8G8 = 0x09,
7 | R16 = 0x0a,
8 | R8G8B8A8 = 0x0b,
9 | R11G11B10 = 0x0f,
10 | R32 = 0x14,
11 | BC1 = 0x1a,
12 | BC2 = 0x1b,
13 | BC3 = 0x1c,
14 | BC4 = 0x1d,
15 | BC5 = 0x1e,
16 | ASTC4x4 = 0x2d,
17 | ASTC5x4 = 0x2e,
18 | ASTC5x5 = 0x2f,
19 | ASTC6x5 = 0x30,
20 | ASTC6x6 = 0x31,
21 | ASTC8x5 = 0x32,
22 | ASTC8x6 = 0x33,
23 | ASTC8x8 = 0x34,
24 | ASTC10x5 = 0x35,
25 | ASTC10x6 = 0x36,
26 | ASTC10x8 = 0x37,
27 | ASTC10x10 = 0x38,
28 | ASTC12x10 = 0x39,
29 | ASTC12x12 = 0x3a
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Formats/TextureFormatVar.cs:
--------------------------------------------------------------------------------
1 | namespace BnTxx.Formats
2 | {
3 | public enum TextureFormatVar
4 | {
5 | UNorm = 1,
6 | SNorm = 2,
7 | UInt = 3,
8 | SInt = 4,
9 | Single = 5,
10 | SRGB = 6,
11 | UHalf = 10
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Formats/TextureType.cs:
--------------------------------------------------------------------------------
1 | namespace BnTxx.Formats
2 | {
3 | public enum TextureType
4 | {
5 | Image1D = 0,
6 | Image2D = 1,
7 | Image3D = 2,
8 | Cube = 3,
9 | CubeFar = 8
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/ISwizzle.cs:
--------------------------------------------------------------------------------
1 | namespace BnTxx
2 | {
3 | public interface ISwizzle
4 | {
5 | int GetSwizzleOffset(int X, int Y);
6 | }
7 | }
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // As informações gerais sobre um assembly são controladas por
6 | // conjunto de atributos. Altere estes valores de atributo para modificar as informações
7 | // associada a um assembly.
8 | [assembly: AssemblyTitle("BnTxx")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("BnTxx")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Definir ComVisible como false torna os tipos neste assembly invisíveis
18 | // para componentes COM. Caso precise acessar um tipo neste assembly de
19 | // COM, defina o atributo ComVisible como true nesse tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // O GUID a seguir será destinado à ID de typelib se este projeto for exposto para COM
23 | [assembly: Guid("9675f3de-df52-4750-9222-ba7707f1566e")]
24 |
25 | // As informações da versão de um assembly consistem nos quatro valores a seguir:
26 | //
27 | // Versão Principal
28 | // Versão Secundária
29 | // Número da Versão
30 | // Revisão
31 | //
32 | // É possível especificar todos os valores ou usar como padrão os Números de Build e da Revisão
33 | // utilizando o "*" como mostrado abaixo:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Utilities/BitUtils.cs:
--------------------------------------------------------------------------------
1 | namespace BnTxx.Utilities
2 | {
3 | static class BitUtils
4 | {
5 | public static int Pow2RoundUp(int Value)
6 | {
7 | Value--;
8 |
9 | Value |= (Value >> 1);
10 | Value |= (Value >> 2);
11 | Value |= (Value >> 4);
12 | Value |= (Value >> 8);
13 | Value |= (Value >> 16);
14 |
15 | return ++Value;
16 | }
17 |
18 | public static int Pow2RoundDown(int Value)
19 | {
20 | return IsPow2(Value) ? Value : Pow2RoundUp(Value) >> 1;
21 | }
22 |
23 | public static bool IsPow2(int Value)
24 | {
25 | return Value != 0 && (Value & (Value - 1)) == 0;
26 | }
27 |
28 | public static int CountZeros(int Value)
29 | {
30 | int Count = 0;
31 |
32 | for (int i = 0; i < 32; i++)
33 | {
34 | if ((Value & (1 << i)) != 0)
35 | {
36 | break;
37 | }
38 |
39 | Count++;
40 | }
41 |
42 | return Count;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/Utilities/IOUtils.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Text;
3 |
4 | namespace BnTxx.Utilities
5 | {
6 | static class IOUtils
7 | {
8 | public static string ReadString(this BinaryReader Reader, int Length)
9 | {
10 | if (Length > 0)
11 | {
12 | long Position = Reader.BaseStream.Position + Length;
13 |
14 | using (MemoryStream MS = new MemoryStream())
15 | {
16 | for (byte Value; Length-- > 0 && (Value = Reader.ReadByte()) != 0;)
17 | {
18 | MS.WriteByte(Value);
19 | }
20 |
21 | Reader.BaseStream.Seek(Position, SeekOrigin.Begin);
22 |
23 | return Encoding.UTF8.GetString(MS.ToArray());
24 | }
25 | }
26 |
27 | return null;
28 | }
29 |
30 | public static string ReadShortString(this BinaryReader Reader)
31 | {
32 | return Reader.ReadString(Reader.ReadUInt16());
33 | }
34 |
35 | public static int Get16(byte[] Data, int Address)
36 | {
37 | return
38 | Data[Address + 0] << 0 |
39 | Data[Address + 1] << 8;
40 | }
41 |
42 | public static int Get32(byte[] Data, int Address)
43 | {
44 | return
45 | Data[Address + 0] << 0 |
46 | Data[Address + 1] << 8 |
47 | Data[Address + 2] << 16 |
48 | Data[Address + 3] << 24;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/FileFormatPlugins/BnTxx/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/FileFormatPlugins/ByamlLib/Byaml/ByamlException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ByamlExt.Byaml
4 | {
5 | ///
6 | /// Represents errors that occur when trying to process invalid BYAML data.
7 | ///
8 | public class ByamlException : Exception
9 | {
10 | // ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------
11 |
12 | ///
13 | /// Initializes a new instance of the class with a specified error message.
14 | ///
15 | /// The message that describes the error.
16 | public ByamlException(string message)
17 | : base(message)
18 | {
19 | }
20 |
21 | ///
22 | /// Initializes a new instance of the class with a specified error message and a
23 | /// reference to the inner exception that is the cause of this exception.
24 | ///
25 | /// The error message that explains the reason for the exception.
26 | /// The exception that is the cause of the current exception, or a null reference if no
27 | /// inner exception is specified.
28 | public ByamlException(string message, Exception inner)
29 | : base(message, inner)
30 | {
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/FileFormatPlugins/ByamlLib/Byaml/ByamlNodeType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace ByamlExt.Byaml
5 | {
6 | ///
7 | /// Represents the type of which a dynamic BYAML node can be.
8 | ///
9 | internal enum ByamlNodeType : byte
10 | {
11 | ///
12 | /// Represents an empty type. Used to detect path nodes
13 | ///
14 | None,
15 |
16 | ///
17 | /// The node represents a (internally referenced by index).
18 | ///
19 | StringIndex = 0xA0,
20 |
21 | ///
22 | /// The node represents a list of instances (internally referenced by index).
23 | ///
24 | PathIndex = 0xA1,
25 |
26 | ///
27 | /// The node represents an array of dynamic child instances.
28 | ///
29 | Array = 0xC0,
30 |
31 | ///
32 | /// The node represents a dictionary of dynamic child instances referenced by a key.
33 | ///
34 | Dictionary = 0xC1,
35 |
36 | ///
37 | /// The node represents an array of instances.
38 | ///
39 | StringArray = 0xC2,
40 |
41 | ///
42 | /// The node represents an array of lists of instances.
43 | ///
44 | PathArray = 0xC3,
45 |
46 | ///
47 | /// The node represents a .
48 | ///
49 | Boolean = 0xD0,
50 |
51 | ///
52 | /// The node represents an .
53 | ///
54 | Integer = 0xD1,
55 |
56 | ///
57 | /// The node represents a .
58 | ///
59 | Float = 0xD2,
60 |
61 | ///
62 | /// The node represents a .
63 | ///
64 | Uinteger = 0xD3,
65 |
66 | ///
67 | /// The node represents a .
68 | ///
69 | Long = 0xD4,
70 |
71 | ///
72 | /// The node represents a .
73 | ///
74 | ULong = 0xD5,
75 |
76 | ///
77 | /// The node represents a .
78 | ///
79 | Double = 0xD6,
80 |
81 | ///
82 | /// The node represents null.
83 | ///
84 | Null = 0xFF
85 | }
86 |
87 | ///
88 | /// Represents extension methods for instances.
89 | ///
90 | internal static class ByamlNodeTypeExtensions
91 | {
92 | ///
93 | /// Gets the corresponding, instantiatable for the given .
94 | ///
95 | /// The which should be instantiated.
96 | /// The to instantiate for the node.
97 | internal static Type GetInstanceType(this ByamlNodeType nodeType)
98 | {
99 | switch (nodeType)
100 | {
101 | case ByamlNodeType.StringIndex:
102 | return typeof(string);
103 | case ByamlNodeType.PathIndex:
104 | return typeof(List);
105 | case ByamlNodeType.Array:
106 | // TODO: Check if this could be loaded as an object array.
107 | throw new ByamlException("Cannot instantiate an array of unknown element type.");
108 | case ByamlNodeType.Dictionary:
109 | // TODO: Check if this could be loaded as a string-object dictionary.
110 | throw new ByamlException("Cannot instantiate an object of unknown type.");
111 | case ByamlNodeType.Boolean:
112 | return typeof(bool);
113 | case ByamlNodeType.Integer:
114 | return typeof(int);
115 | case ByamlNodeType.Float:
116 | return typeof(float);
117 | case ByamlNodeType.Uinteger:
118 | return typeof(UInt32);
119 | case ByamlNodeType.Long:
120 | return typeof(Int64);
121 | case ByamlNodeType.ULong:
122 | return typeof(UInt64);
123 | case ByamlNodeType.Double:
124 | return typeof(double);
125 | case ByamlNodeType.Null:
126 | return typeof(object);
127 | default:
128 | throw new ByamlException($"Unknown node type {nodeType}.");
129 | }
130 | }
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/FileFormatPlugins/ByamlLib/Byaml/ByamlPathPoint.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using Syroot.Maths;
6 |
7 | namespace ByamlExt.Byaml
8 | {
9 | ///
10 | /// Represents a point in a BYAML path.
11 | ///
12 | public class ByamlPathPoint : IEquatable
13 | {
14 | // ---- CONSTANTS ----------------------------------------------------------------------------------------------
15 |
16 | ///
17 | /// The size of a single point in bytes when serialized as BYAML data.
18 | ///
19 | internal const int SizeInBytes = 28;
20 |
21 | // ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------
22 |
23 | ///
24 | /// Initializes a new instance of the class.
25 | ///
26 | public ByamlPathPoint()
27 | {
28 | Normal = new Vector3F(0, 1, 0);
29 | }
30 |
31 | // ---- PROPERTIES ---------------------------------------------------------------------------------------------
32 |
33 | ///
34 | /// Gets or sets the location.
35 | ///
36 | [TypeConverter(typeof(Vector3FConverter))]
37 | public Vector3F Position { get; set; }
38 |
39 | ///
40 | /// Gets or sets the normal.
41 | ///
42 | [TypeConverter(typeof(Vector3FConverter))]
43 | public Vector3F Normal { get; set; }
44 |
45 | ///
46 | /// Gets or sets an unknown value.
47 | ///
48 | public uint Unknown { get; set; }
49 |
50 | // ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
51 |
52 | ///
53 | /// Indicates whether the current object is equal to another object of the same type.
54 | ///
55 | /// An object to compare with this object.
56 | /// true if the current object is equal to the parameter; otherwise, false.
57 | ///
58 | public bool Equals(ByamlPathPoint other)
59 | {
60 | return Position == other.Position && Normal == other.Normal && Unknown == other.Unknown;
61 | }
62 |
63 | public override string ToString()
64 | {
65 | return $"ByamlPathPoint Pos:{Position} Norm:{Normal} Unk:{Unknown}";
66 | }
67 |
68 | class Vector3FConverter : System.ComponentModel.TypeConverter
69 | {
70 | public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, Type sourceType)
71 | {
72 | return sourceType == typeof(string);
73 | }
74 |
75 | public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
76 | {
77 | Vector3F res;
78 | string[] tokens = ((string)value).Split(';');
79 | res.X = Single.Parse(tokens[0]);
80 | res.Y = Single.Parse(tokens[1]);
81 | res.Z = Single.Parse(tokens[2]);
82 | return res;
83 | }
84 |
85 | public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
86 | {
87 | Vector3F val = (Vector3F)value;
88 | return $"{val.X};{val.Y};{val.Z}";
89 | }
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/FileFormatPlugins/ByamlLib/Byaml/BymlPathPointEditor.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ByamlExt
2 | {
3 | partial class BymlPathPointEditor
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
32 | this.SuspendLayout();
33 | //
34 | // propertyGrid1
35 | //
36 | this.propertyGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
37 | | System.Windows.Forms.AnchorStyles.Left)
38 | | System.Windows.Forms.AnchorStyles.Right)));
39 | this.propertyGrid1.Location = new System.Drawing.Point(1, 1);
40 | this.propertyGrid1.Name = "propertyGrid1";
41 | this.propertyGrid1.Size = new System.Drawing.Size(297, 307);
42 | this.propertyGrid1.TabIndex = 0;
43 | //
44 | // BymlPathPointEditor
45 | //
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48 | this.ClientSize = new System.Drawing.Size(299, 309);
49 | this.Controls.Add(this.propertyGrid1);
50 | this.MaximizeBox = false;
51 | this.Name = "BymlPathPointEditor";
52 | this.Text = "BymlPathPointEditor";
53 | this.Load += new System.EventHandler(this.BymlPathPointEditor_Load);
54 | this.ResumeLayout(false);
55 |
56 | }
57 |
58 | #endregion
59 |
60 | private System.Windows.Forms.PropertyGrid propertyGrid1;
61 | }
62 | }
--------------------------------------------------------------------------------
/FileFormatPlugins/ByamlLib/Byaml/BymlPathPointEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ByamlExt
12 | {
13 | public partial class BymlPathPointEditor : Form
14 | {
15 | dynamic target;
16 | public BymlPathPointEditor(dynamic _target)
17 | {
18 | InitializeComponent();
19 | target = _target;
20 | propertyGrid1.SelectedObject = target;
21 | }
22 |
23 | private void BymlPathPointEditor_Load(object sender, EventArgs e)
24 | {
25 |
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/FileFormatPlugins/ByamlLib/Byaml/XmlConverter.cs:
--------------------------------------------------------------------------------
1 | using EditorCore;
2 | using Syroot.BinaryData;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Xml;
10 |
11 | namespace ByamlExt.Byaml
12 | {
13 | static class XmlConverter
14 | {
15 | public static string ToXml(BymlFileData data)
16 | {
17 | var stream = new MemoryStream();
18 | XmlTextWriter xr;
19 | xr = new XmlTextWriter(stream, UnicodeEncoding.Unicode);
20 | xr.Formatting = System.Xml.Formatting.Indented;
21 | xr.WriteStartDocument();
22 | xr.WriteStartElement("Root");
23 | xr.WriteStartElement("isBigEndian");
24 | xr.WriteAttributeString("Value", (data.byteOrder == Syroot.BinaryData.ByteOrder.BigEndian).ToString());
25 | xr.WriteEndElement();
26 | xr.WriteStartElement("BymlFormatVersion");
27 | xr.WriteAttributeString("Value", data.Version.ToString());
28 | xr.WriteEndElement();
29 | xr.WriteStartElement("SupportPaths");
30 | xr.WriteAttributeString("Value", data.SupportPaths.ToString());
31 | xr.WriteEndElement();
32 |
33 | xr.WriteStartElement("BymlRoot");
34 | WriteNode(data.RootNode, null, xr);
35 | xr.WriteEndElement();
36 |
37 | xr.WriteEndElement();
38 | xr.Close();
39 | return UnicodeEncoding.Unicode.GetString(stream.ToArray());
40 | }
41 |
42 | public static BymlFileData ToByml(string xmlString)
43 | {
44 | BymlFileData ret = new BymlFileData();
45 | XmlDocument xml = new XmlDocument();
46 | xml.LoadXml(xmlString);
47 | XmlNode n = xml.SelectSingleNode("/Root/isBigEndian");
48 | ret.byteOrder = n.Attributes["Value"].Value.ToLower() == "true" ? ByteOrder.BigEndian : ByteOrder.LittleEndian;
49 | n = xml.SelectSingleNode("/Root/BymlFormatVersion");
50 | ret.Version = ushort.Parse(n.Attributes["Value"].Value);
51 | n = xml.SelectSingleNode("/Root/SupportPaths");
52 | ret.SupportPaths = n.Attributes["Value"].Value.ToLower() == "true";
53 |
54 | n = xml.SelectSingleNode("/Root/BymlRoot");
55 | if (n.ChildNodes.Count != 1) throw new Exception("A byml can have only one root");
56 | ret.RootNode = ParseNode(n.FirstChild);
57 |
58 | return ret;
59 | }
60 |
61 | #region XmlWriting
62 | static void WriteNode(dynamic node, string name, XmlTextWriter xr)
63 | {
64 | if (node == null)
65 | {
66 | if (name == null) return;
67 | xr.WriteStartElement("NULL");
68 | xr.WriteAttributeString("N", name);
69 | xr.WriteEndElement();
70 | }
71 | else if (node is IList) WriteArrNode((IList)node, name, xr);
72 | else if (node is IDictionary) WriteDictNode((IDictionary)node, name, xr);
73 | else
74 | {
75 | xr.WriteStartElement(GetNodeName(node));
76 | if (name != null)
77 | xr.WriteAttributeString("N", name);
78 | xr.WriteAttributeString("V", node.ToString());
79 | xr.WriteEndElement();
80 | }
81 | }
82 |
83 | static void WriteArrNode(IList node, string name,XmlTextWriter xr)
84 | {
85 | xr.WriteStartElement(GetNodeName(node));
86 | if (name != null)
87 | xr.WriteAttributeString("N", name);
88 | for (int i = 0; i < node.Count; i++)
89 | {
90 | WriteNode(node[i], null, xr);
91 | }
92 | xr.WriteEndElement();
93 | }
94 |
95 | static void WriteDictNode(IDictionary node, string name, XmlTextWriter xr)
96 | {
97 | xr.WriteStartElement(GetNodeName(node));
98 | if (name != null)
99 | xr.WriteAttributeString("N", name);
100 | var keys = node.Keys.ToArray();
101 | for (int i = 0; i < keys.Length; i++)
102 | {
103 | WriteNode(node[keys[i]], keys[i], xr);
104 | }
105 | xr.WriteEndElement();
106 | }
107 |
108 | static string GetNodeName(dynamic node) =>
109 | "T" + ((byte)ByamlFile.GetNodeType(node)).ToString();
110 | #endregion
111 |
112 | #region XmlReading
113 |
114 | static dynamic ParseNode(XmlNode n)
115 | {
116 | if (n.Name == "NULL") return null;
117 | ByamlNodeType nodeType = (ByamlNodeType)byte.Parse(n.Name.Substring(1));
118 | switch (nodeType)
119 | {
120 | case ByamlNodeType.Array:
121 | return ParseArrNode(n);
122 | case ByamlNodeType.Dictionary:
123 | return ParseDictNode(n);
124 | default:
125 | {
126 | Type T = nodeType.GetInstanceType();
127 | return ByamlTypeHelper.ConvertValue(T,n.Attributes["V"].Value);
128 | }
129 | }
130 | }
131 |
132 | static IDictionary ParseDictNode(XmlNode n)
133 | {
134 | Dictionary res = new Dictionary();
135 | for (int i = 0; i < n.ChildNodes.Count; i++)
136 | {
137 | var c = n.ChildNodes[i];
138 | res.Add(c.Attributes["N"].Value, ParseNode(c));
139 | }
140 | return res;
141 | }
142 |
143 | static IList ParseArrNode(XmlNode n)
144 | {
145 | List res = new List();
146 | for (int i = 0; i < n.ChildNodes.Count; i++)
147 | {
148 | res.Add(ParseNode(n.ChildNodes[i]));
149 | }
150 | return res;
151 | }
152 |
153 | #endregion
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/FileFormatPlugins/ByamlLib/ByamlExt.cs:
--------------------------------------------------------------------------------
1 | using EditorCore.Interfaces;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows.Forms;
9 |
10 | namespace ByamlExt
11 | {
12 | class ByamlExt : ExtensionManifest
13 | {
14 | public string ModuleName => "ByamlExt";
15 | public string Author => "Exelix11";
16 | public string ExtraText => "Thanks to Syroot for his useful libs";
17 |
18 | public IMenuExtension MenuExt => new MenuExt();
19 |
20 | public bool HasGameModule => false;
21 | public IGameModule GetNewGameModule() => null;
22 | public IFileHander[] Handlers { get; } = new IFileHander[] { new BymlFileHandler(), new XmlFileHandler() };
23 |
24 | public void CheckForUpdates()
25 | {
26 | return;
27 | }
28 | }
29 |
30 | class XmlFileHandler : IFileHander
31 | {
32 | public string HandlerName => "BymlFileHandler";
33 |
34 | public bool IsFormatSupported(string filename, Stream file)
35 | {
36 | if (filename.EndsWith(".xml"))
37 | {
38 | StreamReader t = new StreamReader(file, Encoding.GetEncoding(932));
39 | string s = t.ReadLine();
40 | if (s != "") return false;
41 | s = t.ReadLine();
42 | if (s != "") return false;
43 | return true;
44 | }
45 | return false;
46 | }
47 |
48 | public void OpenFile(string filename, Stream file)
49 | {
50 | StreamReader t = new StreamReader(file, Encoding.GetEncoding(932));
51 | ByamlViewer.OpenByml(Byaml.XmlConverter.ToByml(t.ReadToEnd()), filename);
52 | }
53 | }
54 |
55 | class BymlFileHandler : IEditableFileHandler
56 | {
57 | public string HandlerName => "BymlFileHandler";
58 |
59 | public bool IsFormatSupported(string filename, Stream file)
60 | {
61 | byte[] header = new byte[2] { (byte)file.ReadByte(), (byte)file.ReadByte() };
62 | return (header[0] == 0x42 && header[1] == 0x59) || (header[1] == 0x42 && header[0] == 0x59);
63 | }
64 |
65 | public void OpenFile(string filename, Stream file) =>
66 | ByamlViewer.OpenByml(file,filename);
67 |
68 | public void OpenFileEdit(string filename, Stream file, Stream saveStream)=>
69 | ByamlViewer.OpenByml(file, filename, saveStream, true);
70 |
71 | }
72 |
73 | class MenuExt : IMenuExtension
74 | {
75 | public MenuExt()
76 | {
77 | ToolsMenuExtensions = new ToolStripMenuItem[]
78 | {
79 | new ToolStripMenuItem(){ Text = "Byaml tools"}
80 | };
81 | var editor = ToolsMenuExtensions[0].DropDownItems.Add("Edit byaml");
82 | editor.Click += BymlEditor;
83 | var xmltool = ToolsMenuExtensions[0].DropDownItems.Add("Import xml");
84 | xmltool.Click += XmlImport;
85 | }
86 |
87 | void XmlImport(object sender, EventArgs e)
88 | {
89 | OpenFileDialog openFile = new OpenFileDialog();
90 | openFile.Filter = "xml file |*.xml| every file | *.*";
91 | if (openFile.ShowDialog() != DialogResult.OK) return;
92 | StreamReader t = new StreamReader(new FileStream(openFile.FileName, FileMode.Open), UnicodeEncoding.Unicode);
93 | ByamlViewer.OpenByml(Byaml.XmlConverter.ToByml(t.ReadToEnd()), Path.GetFileName(openFile.FileName));
94 | }
95 |
96 | void BymlEditor(object sender, EventArgs e)
97 | {
98 | OpenFileDialog openFile = new OpenFileDialog();
99 | openFile.Filter = "byaml file |*.byml;*.byaml| every file | *.*";
100 | if (openFile.ShowDialog() != DialogResult.OK) return;
101 | ByamlViewer.OpenByml(openFile.FileName);
102 | }
103 |
104 | public ToolStripMenuItem[] FileMenuExtensions { get; internal set; }
105 | public ToolStripMenuItem[] ToolsMenuExtensions { get; internal set; }
106 | public ToolStripMenuItem[] TitleBarExtensions { get; internal set; }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/FileFormatPlugins/ByamlLib/ByamlExt.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {6D1801B8-7B24-49D6-83A1-E21CCC280D8E}
8 | Library
9 | Properties
10 | ByamlExt
11 | ByamlExt
12 | v4.6.1
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\..\EditorCore\bin\Debug\Ext\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 | ..\..\packages\Syroot.IO.BinaryData.2.0.0\lib\net45\Syroot.BinaryData.dll
35 |
36 |
37 | ..\..\packages\Syroot.Maths.1.4.0\lib\net45\Syroot.Maths.dll
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | Form
58 |
59 |
60 | ByamlViewer.cs
61 |
62 |
63 | Form
64 |
65 |
66 | BymlPathPointEditor.cs
67 |
68 |
69 |
70 |
71 |
72 |
73 | ByamlViewer.cs
74 |
75 |
76 | BymlPathPointEditor.cs
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | {EE9882D0-F7A7-45E1-971A-1527B7E399F5}
88 | EditorCoreCommon
89 | False
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/FileFormatPlugins/ByamlLib/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Le informazioni generali relative a un assembly sono controllate dal seguente
6 | // set di attributi. Modificare i valori di questi attributi per modificare le informazioni
7 | // associate a un assembly.
8 | [assembly: AssemblyTitle("ByamlExt")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ByamlExt")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
18 | // ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
19 | // COM, impostare su true l'attributo ComVisible per tale tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
23 | [assembly: Guid("6d1801b8-7b24-49d6-83a1-e21ccc280d8e")]
24 |
25 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
26 | //
27 | // Versione principale
28 | // Versione secondaria
29 | // Numero di build
30 | // Revisione
31 | //
32 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
33 | // usando l'asterisco '*' come illustrato di seguito:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/FileFormatPlugins/ByamlLib/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/BinaryDataReaderExtensions.cs:
--------------------------------------------------------------------------------
1 | using Syroot.BinaryData;
2 | using Syroot.NintenTools.MarioKart8.Collisions;
3 | using System.Windows.Media.Media3D;
4 |
5 | namespace Syroot.NintenTools.MarioKart8.IO
6 | {
7 | ///
8 | /// Represents extension methods for instances.
9 | ///
10 | internal static class BinaryDataReaderExtensions
11 | {
12 | // ---- METHODS (INTERNAL) -------------------------------------------------------------------------------------
13 |
14 | ///
15 | /// Reads instances from the current stream and returns them.
16 | ///
17 | /// The extended .
18 | /// The number of instances to read.
19 | /// The instances.
20 | internal static KclFace[] ReadTriangles(this BinaryDataReader self, int count)
21 | {
22 | KclFace[] values = new KclFace[count];
23 | for (int i = 0; i < count; i++)
24 | {
25 | values[i] = new KclFace()
26 | {
27 | Length = self.ReadSingle(),
28 | PositionIndex = self.ReadUInt16(),
29 | DirectionIndex = self.ReadUInt16(),
30 | Normal1Index = self.ReadUInt16(),
31 | Normal2Index = self.ReadUInt16(),
32 | Normal3Index = self.ReadUInt16(),
33 | CollisionFlags = self.ReadUInt16(),
34 | GlobalIndex = self.ReadUInt32()
35 | };
36 | }
37 | return values;
38 | }
39 |
40 | ///
41 | /// Reads a instance from the current stream and returns it.
42 | ///
43 | /// The extended .
44 | /// The instance.
45 | internal static Vector3D ReadVector3D(this BinaryDataReader self)
46 | {
47 | return new Vector3D(self.ReadSingle(), self.ReadSingle(), self.ReadSingle());
48 | }
49 |
50 | ///
51 | /// Reads instances from the current stream and returns them.
52 | ///
53 | /// The extended .
54 | /// The number of instances to read.
55 | /// The instances.
56 | internal static Vector3D[] ReadVector3Ds(this BinaryDataReader self, int count)
57 | {
58 | Vector3D[] values = new Vector3D[count];
59 | for (int i = 0; i < count; i++)
60 | {
61 | values[i] = ReadVector3D(self);
62 | }
63 | return values;
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/BinaryDataWriterExtensions.cs:
--------------------------------------------------------------------------------
1 | using Syroot.BinaryData;
2 | using Syroot.NintenTools.MarioKart8.Collisions;
3 | using System.Windows.Media.Media3D;
4 |
5 | namespace Syroot.NintenTools.MarioKart8.IO
6 | {
7 | ///
8 | /// Represents extension methods for instances.
9 | ///
10 | internal static class BinaryDataWriterExtensions
11 | {
12 | // ---- METHODS (INTERNAL) -------------------------------------------------------------------------------------
13 |
14 | ///
15 | /// Writes instances into the current stream.
16 | ///
17 | /// The extended .
18 | /// The instances.
19 | internal static void Write(this BinaryDataWriter self, KclFace[] values)
20 | {
21 | foreach (KclFace value in values)
22 | {
23 | self.Write(value.Length);
24 | self.Write(value.PositionIndex);
25 | self.Write(value.DirectionIndex);
26 | self.Write(value.Normal1Index);
27 | self.Write(value.Normal2Index);
28 | self.Write(value.Normal3Index);
29 | self.Write(value.CollisionFlags);
30 | self.Write(value.GlobalIndex);
31 | }
32 | }
33 |
34 | ///
35 | /// Writes a instance into the current stream.
36 | ///
37 | /// The extended .
38 | /// The instance.
39 | internal static void Write(this BinaryDataWriter self, Vector3D value)
40 | {
41 | self.Write((float)value.X);
42 | self.Write((float)value.Y);
43 | self.Write((float)value.Z);
44 | }
45 |
46 | ///
47 | /// Writes instances into the current stream.
48 | ///
49 | /// The extended .
50 | /// The instances.
51 | internal static void Write(this BinaryDataWriter self, Vector3D[] values)
52 | {
53 | foreach (Vector3D value in values)
54 | {
55 | Write(self, value);
56 | }
57 | }
58 |
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/KCL/KCLColors.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace MarioKart.MK7
9 | {
10 | class KCLColors
11 | {
12 | public enum CollisionType_MK8D : ushort
13 | {
14 | Road_Default = 0,
15 | Road_Bumpy = 2,
16 | Road_Sand = 4,
17 | Offroad_Sand = 6,
18 | Road_HeavySand = 8,
19 | Road_IcyRoad = 9,
20 | OrangeBooster = 10,
21 | AntiGravityPanel = 11,
22 | Latiku = 16,
23 | Wall5 = 17,
24 | Wall4 = 19,
25 | Wall = 23,
26 | Latiku2 = 28,
27 | Glider = 31,
28 | SidewalkSlope = 32,
29 | Road_Dirt = 33,
30 | Unsolid = 56,
31 | Water = 60,
32 | Road_Stone = 64,
33 | Wall1 = 81,
34 | Wall2 = 84,
35 | FinishLine = 93,
36 | RedFlowerEffect = 95,
37 | Wall3 = 113,
38 | WhiteFlowerEffect = 127,
39 | Road_Metal = 128,
40 | Road_3DS_MP_Piano = 129,
41 | Road_RoyalR_Grass = 134,
42 | TopPillar = 135,
43 | YoshiCuiruit_Grass = 144,
44 | YellowFlowerEffect = 159,
45 |
46 | Road_MetalGating = 160,
47 | Road_3DS_MP_Xylophone = 161,
48 | Road_3DS_MP_Vibraphone = 193,
49 | SNES_RR_road = 227,
50 | Offroad_Mud = 230,
51 | Trick = 4096,
52 | BoosterStunt = 4106,
53 | TrickEndOfRamp = 4108,
54 | Trick3 = 4130,
55 | Trick6 = 4160,
56 | Trick4 = 4224,
57 | Trick5 = 8192,
58 | BoostTrick = 8202,
59 | }
60 |
61 | public static Color GetMaterialColor(ushort coll)
62 | {
63 | switch (coll)
64 | {
65 | case (ushort)CollisionType_MK8D.Road_Default:
66 | return Color.DarkGray;
67 | case (ushort)CollisionType_MK8D.Glider:
68 | return Color.Orange;
69 | case (ushort)CollisionType_MK8D.Road_Sand:
70 | return Color.LightYellow;
71 | case (ushort)CollisionType_MK8D.Offroad_Sand:
72 | return Color.SandyBrown;
73 | case (ushort)CollisionType_MK8D.Water:
74 | return Color.Blue;
75 | case (ushort)CollisionType_MK8D.Wall1:
76 | return Color.LightSlateGray;
77 | case (ushort)CollisionType_MK8D.Wall2:
78 | return Color.OrangeRed;
79 | case (ushort)CollisionType_MK8D.Wall3:
80 | return Color.IndianRed;
81 | case (ushort)CollisionType_MK8D.Unsolid:
82 | return Color.Beige;
83 | case (ushort)CollisionType_MK8D.Road_3DS_MP_Piano:
84 | return Color.RosyBrown;
85 | case (ushort)CollisionType_MK8D.Road_3DS_MP_Vibraphone:
86 | return Color.BurlyWood;
87 | case (ushort)CollisionType_MK8D.Road_3DS_MP_Xylophone:
88 | return Color.DarkSalmon;
89 | case (ushort)CollisionType_MK8D.Latiku:
90 | return Color.GhostWhite;
91 | case (ushort)CollisionType_MK8D.Road_Bumpy:
92 | return Color.GreenYellow;
93 | case (ushort)CollisionType_MK8D.Road_RoyalR_Grass:
94 | return Color.Green;
95 | case (ushort)CollisionType_MK8D.YoshiCuiruit_Grass:
96 | return Color.Green;
97 | case (ushort)CollisionType_MK8D.Wall:
98 | return Color.LightCyan;
99 | case (ushort)CollisionType_MK8D.Wall4:
100 | return Color.LightSlateGray;
101 | case (ushort)CollisionType_MK8D.Wall5:
102 | return Color.DarkSlateGray;
103 | case (ushort)CollisionType_MK8D.AntiGravityPanel:
104 | return Color.Purple;
105 | case (ushort)CollisionType_MK8D.SidewalkSlope:
106 | return Color.FromArgb(153, 153, 102);
107 | case (ushort)CollisionType_MK8D.BoostTrick:
108 | return Color.DarkOrange;
109 | case (ushort)CollisionType_MK8D.Offroad_Mud:
110 | return Color.FromArgb(77, 26, 0);
111 | case (ushort)CollisionType_MK8D.Road_Metal:
112 | return Color.FromArgb(80, 80, 80);
113 | case (ushort)CollisionType_MK8D.Road_MetalGating:
114 | return Color.FromArgb(64, 64, 64);
115 | case (ushort)CollisionType_MK8D.Road_Dirt:
116 | return Color.Sienna;
117 | case (ushort)CollisionType_MK8D.Road_Stone:
118 | return Color.FromArgb(50, 50, 50);
119 | case (ushort)CollisionType_MK8D.Latiku2:
120 | return Color.WhiteSmoke;
121 | case (ushort)CollisionType_MK8D.RedFlowerEffect:
122 | return Color.MediumVioletRed;
123 | case (ushort)CollisionType_MK8D.WhiteFlowerEffect:
124 | return Color.FloralWhite;
125 | case (ushort)CollisionType_MK8D.YellowFlowerEffect:
126 | return Color.Yellow;
127 | case (ushort)CollisionType_MK8D.TopPillar:
128 | return Color.Gray;
129 | default:
130 | return Color.FromArgb(20, 20, 20);
131 | }
132 | }
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/KCL/KCLHeader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Media.Media3D;
3 |
4 | namespace MarioKart
5 | {
6 | public abstract class KCLHeader
7 | {
8 | public UInt32 VerticesOffset;
9 | public UInt32 NormalsOffset;
10 | public UInt32 PlanesOffset;//-0x10
11 | public UInt32 OctreeOffset;
12 | public Single Unknown1;
13 | public Vector3D OctreeOrigin;
14 | public Vector3D OctreeMax;
15 | //public float n_x;
16 | //public float n_y;
17 | //public float n_z;
18 | public UInt32 XMask;
19 | public UInt32 YMask;
20 | public UInt32 ZMask;
21 | public UInt32 CoordShift;
22 | public UInt32 YShift;
23 | public UInt32 ZShift;
24 | public Single Unknown2;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/KCL/Triangle.cs:
--------------------------------------------------------------------------------
1 | using ExtensionMethods;
2 | using System;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Windows.Media.Media3D;
8 |
9 | namespace LibEveryFileExplorer._3D
10 | {
11 | public class Triangle
12 | {
13 | public Triangle(Vector3D A, Vector3D B, Vector3D C)
14 | {
15 | PointA = A;
16 | PointB = B;
17 | PointC = C;
18 | }
19 |
20 | public ushort Collision { get; set; }
21 |
22 | public Vector3D PointA { get; internal set; }
23 | public Vector3D PointB { get; internal set; }
24 | public Vector3D PointC { get; internal set; }
25 |
26 | public Vector3D Normal
27 | {
28 | get
29 | {
30 | return (PointB - PointA).Cross(PointC - PointA).GetNormalize();
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/KCLExt.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {148F75F5-D3F0-4B69-8528-528C5215B351}
8 | Library
9 | Properties
10 | KCLExt
11 | KCLExt
12 | v4.6.1
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\..\EditorCore\bin\Debug\Ext\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 | ..\..\packages\Syroot.IO.BinaryData.2.0.2\lib\net45\Syroot.BinaryData.dll
36 |
37 |
38 | ..\..\packages\Syroot.Maths.1.5.0\lib\net45\Syroot.Maths.dll
39 |
40 |
41 | ..\..\packages\Syroot.NintenTools.MarioKart8.0.5.2\lib\net451\Syroot.NintenTools.MarioKart8.dll
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | Form
63 |
64 |
65 | MaterialSetForm.cs
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | {EE9882D0-F7A7-45E1-971A-1527B7E399F5}
84 | EditorCoreCommon
85 | False
86 |
87 |
88 |
89 |
90 | MaterialSetForm.cs
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/KCLext.cs:
--------------------------------------------------------------------------------
1 | using EditorCore.Common;
2 | using EditorCore.Interfaces;
3 | using MarioKart.MK7;
4 | using Syroot.NintenTools.MarioKart8.Common;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Drawing;
8 | using System.IO;
9 | using System.Linq;
10 | using System.Text;
11 | using System.Threading.Tasks;
12 | using System.Windows.Forms;
13 |
14 | namespace KCLExt
15 | {
16 | public class KCLExt : ExtensionManifest
17 | {
18 | public string ModuleName => "KCL extension";
19 |
20 | public string Author => "Exelix11";
21 |
22 | public string ExtraText => null;
23 |
24 | public bool HasGameModule => false;
25 |
26 | public IMenuExtension MenuExt => new MenuExt();
27 |
28 | public IGameModule GetNewGameModule() => null;
29 |
30 | public IFileHander[] Handlers => null;
31 |
32 | public void CheckForUpdates() { }
33 | }
34 |
35 | class MenuExt : IMenuExtension
36 | {
37 | public ToolStripMenuItem[] FileMenuExtensions => null;
38 | public ToolStripMenuItem[] ToolsMenuExtensions => toolsExt;
39 | public ToolStripMenuItem[] TitleBarExtensions => null;
40 |
41 | ToolStripMenuItem[] toolsExt = new ToolStripMenuItem[2];
42 | public MenuExt()
43 | {
44 | toolsExt[0] = new ToolStripMenuItem("KCL to OBJ");
45 | toolsExt[0].Click += KCLToObj;
46 | toolsExt[1] = new ToolStripMenuItem("OBJ to KCL");
47 | toolsExt[1].Click += ObjToKCL;
48 | }
49 |
50 | private void ObjToKCL(object sender, EventArgs e)
51 | {
52 | OpenFileDialog opn = new OpenFileDialog();
53 | if (opn.ShowDialog() != DialogResult.OK) return;
54 | var mod = OBJ.Read(new MemoryStream(File.ReadAllBytes(opn.FileName)),null);
55 | //if (mod.Faces.Count > 65535)
56 | //{
57 | // MessageBox.Show("this model has too many faces, only models with less than 65535 triangles can be converted");
58 | // return;
59 | //}
60 | var f = MarioKart.MK7.KCL.FromOBJ(mod);
61 | File.WriteAllBytes(opn.FileName + ".kcl", f.Write(Syroot.BinaryData.ByteOrder.BigEndian));
62 | }
63 |
64 | private void KCLToObj(object sender, EventArgs e)
65 | {
66 | OpenFileDialog opn = new OpenFileDialog();
67 | if (opn.ShowDialog() != DialogResult.OK) return;
68 | var kcl = new MarioKart.MK7.KCL(File.ReadAllBytes(opn.FileName));
69 | #if DEBUG
70 | using (StreamWriter f = new System.IO.StreamWriter(opn.FileName + ".obj"))
71 | kcl.ToOBJ().toWritableObj().WriteObj(f, null);
72 | #else
73 | kcl.ToOBJ().toWritableObj().WriteObj(opn.FileName + ".obj");
74 | #endif
75 | }
76 |
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/MaterialSetForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace KCLExt
2 | {
3 | partial class MaterialSetForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.dataGridView1 = new System.Windows.Forms.DataGridView();
32 | this.MatName = new System.Windows.Forms.DataGridViewTextBoxColumn();
33 | this.CollVal = new System.Windows.Forms.DataGridViewTextBoxColumn();
34 | this.menuStrip1 = new System.Windows.Forms.MenuStrip();
35 | this.applyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
36 | ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
37 | this.menuStrip1.SuspendLayout();
38 | this.SuspendLayout();
39 | //
40 | // dataGridView1
41 | //
42 | this.dataGridView1.AllowUserToAddRows = false;
43 | this.dataGridView1.AllowUserToDeleteRows = false;
44 | this.dataGridView1.AllowUserToResizeColumns = false;
45 | this.dataGridView1.AllowUserToResizeRows = false;
46 | this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
47 | this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
48 | this.MatName,
49 | this.CollVal});
50 | this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
51 | this.dataGridView1.Location = new System.Drawing.Point(0, 24);
52 | this.dataGridView1.Name = "dataGridView1";
53 | this.dataGridView1.Size = new System.Drawing.Size(531, 292);
54 | this.dataGridView1.TabIndex = 0;
55 | //
56 | // MatName
57 | //
58 | this.MatName.HeaderText = "Material name";
59 | this.MatName.Name = "MatName";
60 | //
61 | // CollVal
62 | //
63 | this.CollVal.HeaderText = "Collision value";
64 | this.CollVal.Name = "CollVal";
65 | //
66 | // menuStrip1
67 | //
68 | this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
69 | this.applyToolStripMenuItem});
70 | this.menuStrip1.Location = new System.Drawing.Point(0, 0);
71 | this.menuStrip1.Name = "menuStrip1";
72 | this.menuStrip1.Size = new System.Drawing.Size(531, 24);
73 | this.menuStrip1.TabIndex = 1;
74 | this.menuStrip1.Text = "menuStrip1";
75 | //
76 | // applyToolStripMenuItem
77 | //
78 | this.applyToolStripMenuItem.Name = "applyToolStripMenuItem";
79 | this.applyToolStripMenuItem.Size = new System.Drawing.Size(50, 20);
80 | this.applyToolStripMenuItem.Text = "Apply";
81 | this.applyToolStripMenuItem.Click += new System.EventHandler(this.applyToolStripMenuItem_Click);
82 | //
83 | // MaterialSetForm
84 | //
85 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
86 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
87 | this.ClientSize = new System.Drawing.Size(531, 316);
88 | this.ControlBox = false;
89 | this.Controls.Add(this.dataGridView1);
90 | this.Controls.Add(this.menuStrip1);
91 | this.MainMenuStrip = this.menuStrip1;
92 | this.MaximizeBox = false;
93 | this.MinimizeBox = false;
94 | this.Name = "MaterialSetForm";
95 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
96 | this.Text = "Write the material code, close this to continue";
97 | this.TopMost = true;
98 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FClosing);
99 | ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
100 | this.menuStrip1.ResumeLayout(false);
101 | this.menuStrip1.PerformLayout();
102 | this.ResumeLayout(false);
103 | this.PerformLayout();
104 |
105 | }
106 |
107 | #endregion
108 |
109 | private System.Windows.Forms.DataGridView dataGridView1;
110 | private System.Windows.Forms.DataGridViewTextBoxColumn MatName;
111 | private System.Windows.Forms.DataGridViewTextBoxColumn CollVal;
112 | private System.Windows.Forms.MenuStrip menuStrip1;
113 | private System.Windows.Forms.ToolStripMenuItem applyToolStripMenuItem;
114 | }
115 | }
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/MaterialSetForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace KCLExt
12 | {
13 | public partial class MaterialSetForm : Form
14 | {
15 | Dictionary Result;
16 |
17 | private MaterialSetForm(string[] mats)
18 | {
19 | InitializeComponent();
20 | foreach (string s in mats)
21 | dataGridView1.Rows.Add(s, 0);
22 | }
23 |
24 | public static Dictionary ShowForm(string[] Materials)
25 | {
26 | MaterialSetForm f = new MaterialSetForm(Materials);
27 | f.ShowDialog();
28 | return f.Result;
29 | }
30 |
31 | private void FClosing(object sender, FormClosingEventArgs e)
32 | {
33 | Result = new Dictionary();
34 | for (int i = 0; i < dataGridView1.Rows.Count; i++)
35 | {
36 | var v = dataGridView1[1, i].Value.ToString();
37 | Result.Add(dataGridView1[0, i].Value.ToString(), v == "-1" ? ushort.MaxValue : ushort.Parse(v));
38 | }
39 | }
40 |
41 | private void applyToolStripMenuItem_Click(object sender, EventArgs e)
42 | {
43 | dataGridView1.EndEdit();
44 | this.Close();
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/MathUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace LibEveryFileExplorer.Math
7 | {
8 | public class MathUtil
9 | {
10 | public static int Clamp(int value, int min, int max)
11 | {
12 | if (value < min) value = min;
13 | if (value > max) value = max;
14 | return (short)value;
15 | }
16 |
17 | public static float RadToDeg(float Radians)
18 | {
19 | return Radians * (180f / (float)System.Math.PI);
20 | }
21 |
22 | public static double RadToDeg(double Radians)
23 | {
24 | return Radians * (180.0 / System.Math.PI);
25 | }
26 |
27 | public static float DegToRad(float Degrees)
28 | {
29 | return Degrees * ((float)System.Math.PI / 180f);
30 | }
31 |
32 | public static double DegToRad(double Degrees)
33 | {
34 | return Degrees * (System.Math.PI / 180.0);
35 | }
36 |
37 | public static int GetNearest2Power(double Value)
38 | {
39 | return (int)System.Math.Ceiling(System.Math.Log((float)Value, 2));
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Le informazioni generali relative a un assembly sono controllate dal seguente
6 | // set di attributi. Modificare i valori di questi attributi per modificare le informazioni
7 | // associate a un assembly.
8 | [assembly: AssemblyTitle("KCLExt")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("KCLExt")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
18 | // ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
19 | // COM, impostare su true l'attributo ComVisible per tale tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
23 | [assembly: Guid("148f75f5-d3f0-4b69-8528-528c5215b351")]
24 |
25 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
26 | //
27 | // Versione principale
28 | // Versione secondaria
29 | // Numero di build
30 | // Revisione
31 | //
32 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
33 | // usando l'asterisco '*' come illustrato di seguito:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/FileFormatPlugins/KCLExt/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/FileFormatPlugins/SARCLib/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Le informazioni generali relative a un assembly sono controllate dal seguente
6 | // set di attributi. Modificare i valori di questi attributi per modificare le informazioni
7 | // associate a un assembly.
8 | [assembly: AssemblyTitle("SARCExt")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SARCExt")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
18 | // ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
19 | // COM, impostare su true l'attributo ComVisible per tale tipo.
20 | [assembly: ComVisible(false)]
21 |
22 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
23 | [assembly: Guid("9c220305-e452-4db0-9f99-186640268b4f")]
24 |
25 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
26 | //
27 | // Versione principale
28 | // Versione secondaria
29 | // Numero di build
30 | // Revisione
31 | //
32 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
33 | // usando l'asterisco '*' come illustrato di seguito:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/FileFormatPlugins/SARCLib/SARCExt.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {9C220305-E452-4DB0-9F99-186640268B4F}
8 | Library
9 | Properties
10 | SARCExt
11 | SARCExt
12 | v4.6.1
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\..\EditorCore\bin\Debug\Ext\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 | true
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 | true
33 |
34 |
35 |
36 | ..\..\packages\Syroot.IO.BinaryData.2.0.0\lib\net45\Syroot.BinaryData.dll
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | Form
52 |
53 |
54 | SarcEditor.cs
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | SarcEditor.cs
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | {ee9882d0-f7a7-45e1-971a-1527b7e399f5}
73 | EditorCoreCommon
74 | False
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/FileFormatPlugins/SARCLib/Sarc/Yaz0Exception.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 |
4 | namespace Syroot.NintenTools.Yaz0
5 | {
6 | ///
7 | /// Represents an exception caused by invalid Yaz0 data.
8 | ///
9 | public class Yaz0Exception : Exception
10 | {
11 | // ---- CONSTRUCTORS -------------------------------------------------------------------------------------------
12 |
13 | ///
14 | /// Initializes a new instance of the class.
15 | ///
16 | public Yaz0Exception()
17 | {
18 | }
19 |
20 | ///
21 | /// Initializes a new instance of the class with the given message.
22 | ///
23 | /// The message provided with the exception.
24 | public Yaz0Exception(string message)
25 | : base(message)
26 | {
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the class with the given message and inner
31 | /// exception.
32 | ///
33 | /// The message provided with the exception.
34 | /// The inner exception.
35 | public Yaz0Exception(string message, Exception innerException)
36 | : base(message, innerException)
37 | {
38 | }
39 |
40 | ///
41 | /// Initializes a new instance of the class with the given message.
42 | ///
43 | /// A composite format string representing the message.
44 | /// An object array that contains zero or more objects to format.
45 | public Yaz0Exception(string format, params object[] args)
46 | : base(string.Format(CultureInfo.CurrentCulture, format, args))
47 | {
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/FileFormatPlugins/SARCLib/SarcEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.IO;
11 | using EveryFileExplorer;
12 | using EditorCoreCommon;
13 |
14 | namespace SARCExt
15 | {
16 | public partial class SarcEditor : Form
17 | {
18 | public SarcData loadedSarc;
19 | public Stream sourceStream;
20 | public SarcEditor(SarcData sarc, Stream source = null)
21 | {
22 | InitializeComponent();
23 | loadedSarc = sarc;
24 | sourceStream = source;
25 | if (sourceStream == null)
26 | replaceToolStripMenuItem.Enabled = false;
27 | }
28 |
29 | private void SarcEditor_Load(object sender, EventArgs e)
30 | {
31 | if (loadedSarc == null)
32 | {
33 | MessageBox.Show("No sarc has been loaded");
34 | this.Close();
35 | }
36 | else
37 | {
38 | listBox1.Items.AddRange(loadedSarc.Files.Keys.ToArray());
39 | }
40 | }
41 |
42 | private void extractAllFilesToolStripMenuItem_Click(object sender, EventArgs e)
43 | {
44 | ExtractMultipleFiles(loadedSarc.Files.Keys.ToArray());
45 | }
46 |
47 | void ExtractMultipleFiles(IEnumerable files)
48 | {
49 | var dlg = new FolderBrowserDialog();
50 | if (dlg.ShowDialog() != DialogResult.OK)
51 | return;
52 | foreach (string f in files)
53 | {
54 | File.WriteAllBytes(Path.Combine(dlg.SelectedPath, f), loadedSarc.Files[f]);
55 | }
56 | }
57 |
58 | private void extractToolStripMenuItem_Click(object sender, EventArgs e)
59 | {
60 | if (listBox1.SelectedItems.Count > 1)
61 | ExtractMultipleFiles(listBox1.SelectedItems.Cast());
62 | else
63 | {
64 | var sav = new SaveFileDialog() { FileName = listBox1.SelectedItem.ToString()};
65 | if (sav.ShowDialog() != DialogResult.OK)
66 | return;
67 | File.WriteAllBytes(sav.FileName, loadedSarc.Files[listBox1.SelectedItem.ToString()]);
68 | }
69 | }
70 |
71 | private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
72 | {
73 | if (loadedSarc.HashOnly)
74 | {
75 | MessageBox.Show("Can't remove files from a hash only sarc");
76 | return;
77 | }
78 | string[] Targets = listBox1.SelectedItems.Cast().ToArray();
79 | foreach (var item in Targets)
80 | {
81 | loadedSarc.Files.Remove(item);
82 | listBox1.Items.Remove(item);
83 | }
84 | }
85 |
86 | private void addFilesToolStripMenuItem_Click(object sender, EventArgs e)
87 | {
88 | if (loadedSarc.HashOnly)
89 | {
90 | MessageBox.Show("Can't add files to a hash only sarc");
91 | return;
92 | }
93 | var opn = new OpenFileDialog() { Multiselect = true };
94 | if (opn.ShowDialog() != DialogResult.OK)
95 | return;
96 | foreach (var f in opn.FileNames)
97 | {
98 | string name = Path.GetFileName(f);
99 | if (EditorCore.InputDialog.Show("File name", "Write the name for this file, use / to place it in a folder", ref name) != DialogResult.OK)
100 | return;
101 |
102 | if (loadedSarc.Files.ContainsKey(name))
103 | {
104 | MessageBox.Show($"File {name} already in szs");
105 | continue;
106 | }
107 | loadedSarc.Files.Add(name, File.ReadAllBytes(f));
108 | listBox1.Items.Add(name);
109 | }
110 | }
111 |
112 | private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
113 | {
114 | var sav = new SaveFileDialog() { Filter = "szs file|*.szs|sarc file|*.sarc" };
115 | if (sav.ShowDialog() != DialogResult.OK)
116 | return;
117 | if (numericUpDown1.Value == 0)
118 | File.WriteAllBytes(sav.FileName, SARC.PackN(loadedSarc).Item2);
119 | else
120 | {
121 | var s = SARC.PackN(loadedSarc);
122 | File.WriteAllBytes(sav.FileName, YAZ0.Compress(s.Item2, (int)numericUpDown1.Value,(uint)s.Item1));
123 | }
124 | }
125 |
126 | private void replaceToolStripMenuItem_Click(object sender, EventArgs e)
127 | {
128 | byte[] compressedSarc = null;
129 | var s = SARC.PackN(loadedSarc);
130 | if (numericUpDown1.Value != 0)
131 | compressedSarc = YAZ0.Compress(s.Item2, (int)numericUpDown1.Value,(uint)s.Item1);
132 | else
133 | compressedSarc = s.Item2;
134 | //sourceStream.Position = 0;
135 | sourceStream.Write(compressedSarc, 0, compressedSarc.Length);
136 | }
137 |
138 | private void ListBoxDoubleClick(object sender, EventArgs e)
139 | {
140 | if (listBox1.SelectedItem == null)
141 | return;
142 | var Fname = listBox1.SelectedItem.ToString();
143 | var saveStream = new MemoryStream();
144 | OpenFileHandler.OpenFileEditable(Fname, new MemoryStream(loadedSarc.Files[Fname]), saveStream);
145 | if (saveStream.Length != 0)
146 | loadedSarc.Files[Fname] = saveStream.ToArray();
147 | }
148 |
149 | private void replaceToolStripMenuItem1_Click(object sender, EventArgs e)
150 | {
151 | if (listBox1.SelectedItem == null) return;
152 | var opn = new OpenFileDialog();
153 | if (opn.ShowDialog() != DialogResult.OK) return;
154 | loadedSarc.Files[listBox1.SelectedItem.ToString()] = File.ReadAllBytes(opn.FileName);
155 | }
156 |
157 | private void copyNameToolStripMenuItem_Click(object sender, EventArgs e)
158 | {
159 | if (listBox1.SelectedItem == null) return;
160 | Clipboard.SetText(listBox1.SelectedItem.ToString());
161 | }
162 |
163 | private void renameToolStripMenuItem_Click(object sender, EventArgs e)
164 | {
165 | if (listBox1.SelectedItem == null) return;
166 | string originalName = listBox1.SelectedItem.ToString();
167 | string name = Path.GetFileName(originalName);
168 | if (EditorCore.InputDialog.Show("File name", "Write the name for this file, use / to place it in a folder", ref name) != DialogResult.OK)
169 | return;
170 |
171 | if (loadedSarc.Files.ContainsKey(name))
172 | {
173 | MessageBox.Show($"File {name} already in szs");
174 | return;
175 | }
176 | loadedSarc.Files.Add(name, loadedSarc.Files[originalName]);
177 | loadedSarc.Files.Remove(originalName);
178 | listBox1.Items.Add(name);
179 | listBox1.Items.Remove(originalName);
180 | }
181 | }
182 | }
183 |
--------------------------------------------------------------------------------
/FileFormatPlugins/SARCLib/SarcExt.cs:
--------------------------------------------------------------------------------
1 | using EditorCore.Interfaces;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 | using EveryFileExplorer;
9 | using System.IO;
10 | using EditorCore;
11 | using EditorCoreCommon;
12 |
13 | namespace SARCExt
14 | {
15 | class SarcExt : ExtensionManifest
16 | {
17 | public string ModuleName => "Sarc Extension";
18 | public string Author => "Exelix11";
19 | public string ExtraText => "Thanks to:\r\nGericom for Every File Explorer\r\nAboodXD for Sarclib";
20 |
21 | public Version TargetVersion => new Version(1, 0, 0, 0);
22 |
23 | public IMenuExtension MenuExt => new MenuExt();
24 |
25 | public bool HasGameModule => false;
26 | public IGameModule GetNewGameModule() => null;
27 |
28 | public IFileHander[] Handlers { get; } = new IFileHander[] { new SarcHandler(), new SzsHandler() };
29 |
30 | public void CheckForUpdates()
31 | {
32 | return;
33 | }
34 | }
35 |
36 | class SarcHandler : IFileHander
37 | {
38 | public string HandlerName => "SARC file handler";
39 |
40 | public bool IsFormatSupported(string filename, Stream file)
41 | {
42 | byte[] header = new byte[4];
43 | file.Read(header, 0, 4);
44 | return header[0] == 'S' && header[1] == 'A' && header[2] == 'R' && header[3] == 'C';
45 | }
46 |
47 | public void OpenFile(string filename, Stream file)
48 | {
49 | new SarcEditor(SARC.UnpackRamN(file)).Show();
50 | }
51 | }
52 |
53 | class SzsHandler : IFileHander
54 | {
55 | public string HandlerName => "SZS file handler";
56 |
57 | public bool IsFormatSupported(string filename, Stream file)
58 | {
59 | byte[] header = new byte[4];
60 | file.Read(header, 0, 4);
61 | return header[0] == 'Y' && header[1] == 'a' && header[2] == 'z' && header[3] == '0';
62 | }
63 |
64 | public void OpenFile(string filename, Stream file)
65 | {
66 | byte[] data;
67 | if (file is MemoryStream)
68 | data = ((MemoryStream)file).ToArray();
69 | else
70 | {
71 | var s = new MemoryStream();
72 | file.CopyTo(s);
73 | data = s.ToArray();
74 | s.Dispose();
75 | }
76 | OpenFileHandler.OpenFile(filename, new MemoryStream(YAZ0.Decompress(data)));
77 | }
78 | }
79 |
80 | class MenuExt : IMenuExtension
81 | {
82 | public MenuExt()
83 | {
84 | ToolsMenuExtensions = new ToolStripMenuItem[]
85 | {
86 | new ToolStripMenuItem(){ Text = "Yaz0 compression"},
87 | new ToolStripMenuItem(){ Text = "Szs editor"}
88 | };
89 | ToolsMenuExtensions[0].DropDownItems.Add(new ToolStripMenuItem() { Text = "Compress" });
90 | ToolsMenuExtensions[0].DropDownItems.Add(new ToolStripMenuItem() { Text = "Deompress" });
91 | ToolsMenuExtensions[0].DropDownItems[0].Click += Compress;
92 | ToolsMenuExtensions[0].DropDownItems[1].Click += Decompress;
93 | ToolsMenuExtensions[1].Click += SarcEditor;
94 | }
95 |
96 | public ToolStripMenuItem[] FileMenuExtensions { get; internal set; }
97 | public ToolStripMenuItem[] ToolsMenuExtensions { get; internal set; }
98 | public ToolStripMenuItem[] TitleBarExtensions { get; internal set; }
99 |
100 | void SarcEditor(object sender, EventArgs e)
101 | {
102 | OpenFileDialog opn = new OpenFileDialog() { Filter = "szs file|*.szs|every file|*.*" };
103 | if (opn.ShowDialog() != DialogResult.OK) return;
104 | byte[] file = File.ReadAllBytes(opn.FileName);
105 | if (file[0] == 'S' && file[1] == 'A' && file[2] == 'R' && file[3] == 'C')
106 | new SarcEditor(SARC.UnpackRamN(file)).Show();
107 | else if (file[0] == 'Y' && file[1] == 'a' && file[2] == 'z' && file[3] == '0')
108 | new SarcEditor(SARC.UnpackRamN(YAZ0.Decompress(file))).Show();
109 | else
110 | MessageBox.Show("Unknown file format");
111 | }
112 |
113 | void Compress(object sender, EventArgs e)
114 | {
115 | OpenFileDialog openFile = new OpenFileDialog();
116 | openFile.Filter = "every file | *.*";
117 | if (openFile.ShowDialog() != DialogResult.OK) return;
118 |
119 | string strRes = "3";
120 | var res = InputDialog.Show("Enter a compression level", "Select a compression level between 1 (fastest) and 9 (slowest)", ref strRes);
121 | if (res != DialogResult.OK)
122 | return;
123 |
124 | int Level;
125 | if (!int.TryParse(strRes, out Level) || Level < 1 || Level > 9)
126 | {
127 | MessageBox.Show("The selected value is not valid");
128 | return;
129 | }
130 |
131 | System.IO.File.WriteAllBytes( openFile.FileName + ".yaz0",
132 | EveryFileExplorer.YAZ0.Compress(openFile.FileName, Level));
133 | GC.Collect();
134 | }
135 |
136 | void Decompress(object sender, EventArgs e)
137 | {
138 | OpenFileDialog openFile = new OpenFileDialog();
139 | openFile.Filter = "every file | *.*";
140 | if (openFile.ShowDialog() != DialogResult.OK) return;
141 | System.IO.File.WriteAllBytes(openFile.FileName + ".bin",
142 | EveryFileExplorer.YAZ0.Decompress(openFile.FileName));
143 | GC.Collect();
144 | }
145 |
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/FileFormatPlugins/SARCLib/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ModelViewer/ModelViewerCore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {44045645-B2AB-43D0-A1B7-A67A9D00DC4B}
8 | library
9 | Properties
10 | ModelViewer
11 | ModelViewer
12 | v4.5.2
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 | ..\packages\HelixToolkit.2.2.0\lib\netstandard1.1\HelixToolkit.dll
37 |
38 |
39 | ..\packages\HelixToolkit.Wpf.2.2.0\lib\net45\HelixToolkit.Wpf.dll
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | 4.0
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | MSBuild:Compile
60 | Designer
61 |
62 |
63 | RendererControl.xaml
64 | Code
65 |
66 |
67 |
68 |
69 | Code
70 |
71 |
72 | True
73 | True
74 | Resources.resx
75 |
76 |
77 | True
78 | Settings.settings
79 | True
80 |
81 |
82 | ResXFileCodeGenerator
83 | Resources.Designer.cs
84 |
85 |
86 |
87 |
88 | SettingsSingleFileGenerator
89 | Settings.Designer.cs
90 | Designer
91 |
92 |
93 |
94 |
95 |
102 |
--------------------------------------------------------------------------------
/ModelViewer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // Le informazioni generali relative a un assembly sono controllate dal seguente
8 | // set di attributi. Modificare i valori di questi attributi per modificare le informazioni
9 | // associate a un assembly.
10 | [assembly: AssemblyTitle("ModelViewer")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("ModelViewer")]
15 | [assembly: AssemblyCopyright("Copyright © 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
20 | // ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
21 | // COM, impostare su true l'attributo ComVisible per tale tipo.
22 | [assembly: ComVisible(false)]
23 |
24 | //Per iniziare la compilazione delle applicazioni localizzabili, impostare
25 | //CultureYouAreCodingWith nel file .csproj
26 | //all'interno di un . Ad esempio, se si utilizza l'inglese (Stati Uniti)
27 | //nei file di origine, impostare su en-US. Rimuovere quindi il commento dall'attributo
28 | //NeutralResourceLanguage riportato di seguito. Aggiornare "en-US" nella
29 | //riga sottostante in modo che corrisponda all'impostazione UICulture nel file di progetto.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly:ThemeInfo(
35 | ResourceDictionaryLocation.None, //dove si trovano i dizionari delle risorse specifiche del tema
36 | //(in uso se non è possibile trovare una risorsa nella pagina
37 | // oppure nei dizionari delle risorse dell'applicazione)
38 | ResourceDictionaryLocation.SourceAssembly //dove si trova il dizionario delle risorse generiche
39 | //(in uso se non è possibile trovare una risorsa nella pagina,
40 | // nell'applicazione o nei dizionari delle risorse specifiche del tema)
41 | )]
42 |
43 |
44 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
45 | //
46 | // Versione principale
47 | // Versione secondaria
48 | // Numero di build
49 | // Revisione
50 | //
51 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
52 | // usando l'asterisco '*' come illustrato di seguito:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/ModelViewer/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Codice generato da uno strumento.
4 | // Versione di runtime:4.0.30319.42000
5 | //
6 | // Le modifiche apportate a questo file possono causare un comportamento non corretto e andranno perse se
7 | // il codice viene rigenerato.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ModelViewer.Properties {
12 |
13 |
14 | ///
15 | /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
16 | ///
17 | // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder
18 | // tramite uno strumento quale ResGen o Visual Studio.
19 | // Per aggiungere o rimuovere un membro, modificare il file .ResX, quindi eseguire di nuovo ResGen
20 | // con l'opzione /str oppure ricompilare il progetto VS.
21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
24 | internal class Resources {
25 |
26 | private static global::System.Resources.ResourceManager resourceMan;
27 |
28 | private static global::System.Globalization.CultureInfo resourceCulture;
29 |
30 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
31 | internal Resources() {
32 | }
33 |
34 | ///
35 | /// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe.
36 | ///
37 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
38 | internal static global::System.Resources.ResourceManager ResourceManager {
39 | get {
40 | if ((resourceMan == null)) {
41 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ModelViewer.Properties.Resources", typeof(Resources).Assembly);
42 | resourceMan = temp;
43 | }
44 | return resourceMan;
45 | }
46 | }
47 |
48 | ///
49 | /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte
50 | /// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata.
51 | ///
52 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
53 | internal static global::System.Globalization.CultureInfo Culture {
54 | get {
55 | return resourceCulture;
56 | }
57 | set {
58 | resourceCulture = value;
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/ModelViewer/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/ModelViewer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Il codice è stato generato da uno strumento.
4 | // Versione runtime:4.0.30319.42000
5 | //
6 | // Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
7 | // il codice viene rigenerato.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ModelViewer.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ModelViewer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ModelViewer/RendererControl.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ModelViewer/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ModelViewer/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # EditorCore
2 | This is a generic 3D level editor, it can be extended to support different games, right now it's only
3 | a proof of concept, it requires more developement to adapt to different game engines.
4 | The only projects needed are EditorCore and ModelViewerCore, the others are related to the extensions.
5 |
6 | BfresLib,BnTxx,ByamlExt and SarcExt can be reused for other Switch games as they handle common file formats.
7 |
8 | ## What's done
9 | - 3D level editor, with search, drag, raycast, and undo
10 | - Interfaces for level files and objects
11 | - Plugin structure to load different extensions at once (but only one GameExtension)
12 | - Paths rendering
13 | - Super mario odyssey plugin to edit levels.
14 | - Mario Kart 8 Deluxe plugin to edit courses.
15 | - Captain Toad Treasure Tracker plugin to edit levels.
16 |
17 | ## What's missing
18 | - A native/GPU-accelerated 3D renderer, the current one uses WPF and is kinda laggy
19 | - Undo is not fully implemented
20 | - Probably other stuff
21 |
22 | ## Screenshots
23 |
24 | 
25 |
26 | 
27 |
28 | ## Controls
29 | There are two camera modes, choose the one you like from the settings.
30 |
31 | Hotkey | action
32 | |---|---|
33 | Space | Move camera to selected object
34 | Ctrl + drag object | Drag an object in the 3d view
35 | Alt while dragging | Snap the object every 100 units
36 | Shift while dragging | Snap the object every 50 units
37 | \+ | Add a new object
38 | D | Duplicate selection
39 | Del | Delete selection
40 | H | Hide selection from view
41 | C | Edit the links of the selected object
42 | B (while editing a links list) | Go back to the previous list
43 | Q | Switch camera mode
44 |
45 | ## Custom plugins
46 | To know how to create custom plugins check the [wiki page](https://github.com/exelix11/EditorCore/wiki)
47 |
48 | ## Building
49 | This repo contains just the editor and its libs, to use it you also need a game module : \
50 | [Super Mario Odyssey module](https://github.com/exelix11/OdysseyEditor) \
51 | [Mario Kart 8 and Captain Toad modules](https://github.com/exelix11/EditorCore-Examples)
52 |
53 | to build you might want to setup the folders the way the visual studio solution is set:
54 | > (Root EditorCore directory)\
55 | > |-EditorCore \
56 | > | |-EditorCore.sln \
57 | > | |-(other files) \
58 | > |-GamePlugins \
59 | > | |-OdysseyExt \
60 | > | | |-OdysseyExt.csproj \
61 | > | | |-(other files) \
62 | > | |-MK8DExt \
63 | > | | |-MK8DExt.csproj \
64 | > | | |-(other files)
65 |
66 | This way the you should be able to build without issues, you just have to restore nuget packages.
67 |
68 | If you add a new project make sure to set it's build path to the Ext folder in the bin directory of EditorCore. The dll name should end with Ext.dll
69 |
70 | To build a custom plugin (also applies to CTTT3DSExt) : \
71 | Reference EditorCoreCommon.dll and the other needed libs in the project and it should compile. If you're using visual studio you can also debug the plugin without the editor soruce code by attaching the debugger to the editor process.
72 |
73 | ## Credits
74 | This editor contains code or libraries from:
75 | - [KillzXGaming's BFRES C# code ](https://github.com/KillzXGaming/Smash-Forge)
76 | - [gdkchan's BnTxx ](https://github.com/gdkchan/BnTxx)
77 | - [Gericom's EveryFileExplorer](https://github.com/Gericom/EveryFileExplorer)
78 | - [masterf0x's RedCarpet](https://github.com/masterf0x/RedCarpet)
79 | - [AboodXD's SarcLib](https://github.com/aboood40091/SarcLib/)
80 |
--------------------------------------------------------------------------------