Skip to content

Commit 3025530

Browse files
committed
Update source
1 parent d8f27a8 commit 3025530

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+8387
-51
lines changed

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
path = Toolbox.Core
99
url = https://github.com/KillzXGaming/Toolbox.Core
1010
branch = map-studio
11+
[submodule "MPLibrary"]
12+
path = MPLibrary
13+
url = https://github.com/KillzXGaming/MPLibrary.git
14+
branch = master

GLFrameworkEngine

Submodule GLFrameworkEngine updated 89 files

MPLibrary

Submodule MPLibrary added at 61349ec

MapStudio.UI

Submodule MapStudio.UI updated 87 files

PartyStudio.sln

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PartyStudioPlugin", "Plugin
1717
EndProject
1818
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PartyStudio", "Track Studio\PartyStudio.csproj", "{9DB96A72-CFF2-4FBF-910A-B34C789AF5E6}"
1919
EndProject
20+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MPLibrary", "MPLibrary\MPLibrary\MPLibrary.csproj", "{62DDBFEE-92BD-4A3F-B99E-1B9759107920}"
21+
EndProject
22+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Externals", "Externals", "{5AB9C367-2662-41C3-AB8F-368FB075C3F0}"
23+
EndProject
2024
Global
2125
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2226
Debug|Any CPU = Debug|Any CPU
@@ -99,12 +103,28 @@ Global
99103
{9DB96A72-CFF2-4FBF-910A-B34C789AF5E6}.Release|x64.Build.0 = Release|Any CPU
100104
{9DB96A72-CFF2-4FBF-910A-B34C789AF5E6}.Release|x86.ActiveCfg = Release|Any CPU
101105
{9DB96A72-CFF2-4FBF-910A-B34C789AF5E6}.Release|x86.Build.0 = Release|Any CPU
106+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
107+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Debug|Any CPU.Build.0 = Debug|Any CPU
108+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Debug|x64.ActiveCfg = Debug|Any CPU
109+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Debug|x64.Build.0 = Debug|Any CPU
110+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Debug|x86.ActiveCfg = Debug|Any CPU
111+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Debug|x86.Build.0 = Debug|Any CPU
112+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Release|Any CPU.ActiveCfg = Release|Any CPU
113+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Release|Any CPU.Build.0 = Release|Any CPU
114+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Release|x64.ActiveCfg = Release|Any CPU
115+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Release|x64.Build.0 = Release|Any CPU
116+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Release|x86.ActiveCfg = Release|Any CPU
117+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920}.Release|x86.Build.0 = Release|Any CPU
102118
EndGlobalSection
103119
GlobalSection(SolutionProperties) = preSolution
104120
HideSolutionNode = FALSE
105121
EndGlobalSection
106122
GlobalSection(NestedProjects) = preSolution
123+
{BCE75338-6718-4B7D-982A-BB8AA3B2DD39} = {5AB9C367-2662-41C3-AB8F-368FB075C3F0}
124+
{18282923-CF8E-44B1-AB60-822E4EB5D81C} = {5AB9C367-2662-41C3-AB8F-368FB075C3F0}
125+
{0779CE2E-B165-4DBB-B778-1E39B5645A34} = {5AB9C367-2662-41C3-AB8F-368FB075C3F0}
107126
{27334545-B794-4485-89F2-7D1874A57618} = {44D34303-323A-4291-B8E4-E2B12ACA17C9}
127+
{62DDBFEE-92BD-4A3F-B99E-1B9759107920} = {5AB9C367-2662-41C3-AB8F-368FB075C3F0}
108128
EndGlobalSection
109129
GlobalSection(ExtensibilityGlobals) = postSolution
110130
SolutionGuid = {631A19BB-11BA-4D23-BA6B-0509CA9CC6AD}

Plugins/PartyStudio/PartyStudioPlugin.csproj

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -11,17 +11,19 @@
1111
<ItemGroup>
1212
<ProjectReference Include="..\..\GLFrameworkEngine\GLFrameworkEngine.csproj" />
1313
<ProjectReference Include="..\..\MapStudio.UI\MapStudio.UI.csproj" />
14+
<ProjectReference Include="..\..\MPLibrary\MPLibrary\MPLibrary.csproj" />
15+
<ProjectReference Include="..\..\Toolbox.Core\Toolbox.Core.csproj" />
1416
</ItemGroup>
1517

1618
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
1719
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
18-
<OutputPath>..\..\Track Studio\bin\Debug\net5.0\plugins\</OutputPath>
20+
<OutputPath>..\..\Track Studio\bin\Debug\net6.0\plugins\</OutputPath>
1921
</PropertyGroup>
2022

2123
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
2224
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
2325
<Optimize>false</Optimize>
24-
<OutputPath>..\..\Track Studio\bin\Release\net5.0\plugins\</OutputPath>
26+
<OutputPath>..\..\Track Studio\bin\Release\net6.0\plugins\</OutputPath>
2527
</PropertyGroup>
2628

2729
<ItemGroup>
@@ -37,9 +39,15 @@
3739
<Reference Include="CafeLibrary">
3840
<HintPath>..\..\Track Studio\Lib\CafeLibrary.dll</HintPath>
3941
</Reference>
42+
<Reference Include="GCNRenderLibrary">
43+
<HintPath>..\..\Track Studio\Lib\GCNRenderLibrary.dll</HintPath>
44+
</Reference>
4045
<Reference Include="ImGui.NET">
4146
<HintPath>..\..\Track Studio\Lib\ImGui.NET.dll</HintPath>
4247
</Reference>
48+
<Reference Include="IONET">
49+
<HintPath>..\..\Track Studio\Lib\IONET.dll</HintPath>
50+
</Reference>
4351
<Reference Include="Newtonsoft.Json">
4452
<HintPath>..\..\MapStudio\Lib\Newtonsoft.Json.dll</HintPath>
4553
</Reference>

Plugins/PartyStudio/src/BoardLoader.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.IO;
55
using System.Threading.Tasks;
6+
using MapStudio.UI;
67

78
namespace PartyStudioPlugin
89
{
@@ -30,12 +31,12 @@ public class BoardLoader
3031
/// </summary>
3132
public BoardPathRenderer PathRender;
3233

33-
public virtual void LoadFile(MapEditorPlugin mapEditor, Stream data, string fileName)
34+
public virtual void LoadFile(FileEditor mapEditor, Stream data, string fileName)
3435
{
3536

3637
}
3738

38-
public virtual void SaveFile(MapEditorPlugin mapEditor, Stream data)
39+
public virtual void SaveFile(FileEditor mapEditor, Stream data)
3940
{
4041
}
4142
}

Plugins/PartyStudio/src/BoardPathRenderer.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ public BoardPathRenderer(BoardLoader boardLoader) {
3636
LineColor = new Vector4(1, 1, 0, 1);
3737
IsArrowCentered = true;
3838
LineWidth = 2;
39-
PointSize = 0.3f;
39+
PointSize = 0.25f;
40+
ArrowScale = 10f;
41+
ScaleByCamera = false;
42+
43+
//smp todo
44+
ArrowScale = 0.1f;
4045

4146
SegmentDrawPointLength = 20;
4247

@@ -86,26 +91,26 @@ public void UpdateChildren()
8691
}
8792
}
8893

89-
public override void OnMouseDown(MouseEventInfo mouseInfo)
94+
public override void OnMouseDown(GLContext context, MouseEventInfo mouseInfo)
9095
{
91-
base.OnMouseDown(mouseInfo);
96+
base.OnMouseDown(context, mouseInfo);
9297
}
9398

94-
public override void OnKeyDown(KeyEventInfo keyInfo)
99+
public override void OnKeyDown(GLContext context, KeyEventInfo keyInfo)
95100
{
96-
base.OnKeyDown(keyInfo);
101+
base.OnKeyDown(context, keyInfo);
97102
if (keyInfo.IsKeyDown(InputSettings.INPUT.Scene.Create))
98103
{
99104
var selected = GetSelectedPoints().FirstOrDefault();
100105

101-
GLContext.ActiveContext.Scene.BeginUndoCollection();
102-
var pt = (BoardPathPoint)AddSinglePoint();
106+
context.Scene.BeginUndoCollection();
107+
var pt = (BoardPathPoint)AddSinglePoint(context);
103108
if (selected != null && !KeyEventInfo.State.KeyCtrl)
104109
selected.AddChild(pt);
105-
GLContext.ActiveContext.Scene.EndUndoCollection();
110+
context.Scene.EndUndoCollection();
106111
}
107112
if (keyInfo.IsKeyDown(InputSettings.INPUT.Scene.Dupe))
108-
this.DuplicateSelected();
113+
this.DuplicateSelected(context);
109114
}
110115

111116
public override RenderablePathPoint CreatePoint(Vector3 position) {
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using OpenTK;
5+
using OpenTK.Graphics.OpenGL;
6+
7+
namespace GLFrameworkEngine
8+
{
9+
public class CollisionFloorVisual : RenderMesh<VertexPositionTexCoord>, IDrawable
10+
{
11+
/// <summary>
12+
/// Toggles to display a solid floor or not.
13+
/// </summary>
14+
public static bool Display = true;
15+
16+
public static float Height = 0f;
17+
18+
/// <summary>
19+
/// The texture to display on the solid floor.
20+
/// </summary>
21+
public GLTexture Texture = null;
22+
23+
private StandardMaterial Material = new StandardMaterial();
24+
25+
//scale of the floor
26+
private const float SCALE = 200;
27+
28+
public CollisionFloorVisual() : base(Vertices, PrimitiveType.TriangleStrip)
29+
{
30+
}
31+
32+
static VertexPositionTexCoord[] Vertices => new VertexPositionTexCoord[]
33+
{
34+
new VertexPositionTexCoord(new Vector3(1.0f, Height, 1.0f) * SCALE, new Vector2(0, 1)),
35+
new VertexPositionTexCoord(new Vector3(1.0f, Height,-1.0f) * SCALE, new Vector2(0, 0)),
36+
new VertexPositionTexCoord(new Vector3(-1.0f,Height, 1.0f) * SCALE, new Vector2(1, 1)),
37+
new VertexPositionTexCoord(new Vector3(-1.0f,Height,-1.0f) * SCALE, new Vector2(1, 0)),
38+
};
39+
40+
public bool IsVisible { get; set; } = true;
41+
42+
public void SetImage(string filePath)
43+
{
44+
if (System.IO.File.Exists(filePath))
45+
Texture = GLTexture2D.FromBitmap(filePath);
46+
}
47+
48+
public void Update()
49+
{
50+
this.UpdateVertexData(Vertices);
51+
}
52+
53+
public void DrawModel(GLContext control, Pass pass)
54+
{
55+
if (pass != Pass.OPAQUE || !Display)
56+
return;
57+
58+
if (Texture != null)
59+
Material.DiffuseTextureID = Texture.ID;
60+
61+
Material.Render(control);
62+
this.Draw(control);
63+
64+
GL.UseProgram(0);
65+
}
66+
}
67+
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Toolbox.Core.IO;
7+
using Toolbox.Core;
8+
using MapStudio.UI;
9+
10+
namespace PartyStudio.MP10
11+
{
12+
public class PAC : FileEditor, IFileFormat, IArchiveFile
13+
{
14+
public bool CanSave { get; set; } = true;
15+
16+
public string[] Description { get; set; } = new string[] { "ND Cubed PAC" };
17+
public string[] Extension { get; set; } = new string[] { "*.pac" };
18+
19+
public File_Info FileInfo { get; set; }
20+
21+
public bool Identify(File_Info fileInfo, System.IO.Stream stream)
22+
{
23+
using (var reader = new FileReader(stream, true))
24+
{
25+
return reader.CheckSignature(3, "PAC");
26+
}
27+
}
28+
29+
public bool CanAddFiles { get; set; } = true;
30+
public bool CanRenameFiles { get; set; }
31+
public bool CanReplaceFiles { get; set; } = true;
32+
public bool CanDeleteFiles { get; set; } = true;
33+
34+
public void ClearFiles() { files.Clear(); }
35+
36+
public IEnumerable<ArchiveFileInfo> Files => files;
37+
public List<FileEntry> files = new List<FileEntry>();
38+
39+
public PAC() { }
40+
41+
public PAC(string fileName) {
42+
Load(System.IO.File.OpenRead(fileName));
43+
}
44+
45+
public PAC(System.IO.Stream stream) {
46+
Load(stream);
47+
}
48+
49+
public void Load(System.IO.Stream stream)
50+
{
51+
using (var reader = new FileReader(stream))
52+
{
53+
reader.SetByteOrder(true);
54+
55+
uint signature = reader.ReadUInt32();
56+
uint headerSize = reader.ReadUInt32();
57+
reader.ReadUInt32(); //padding
58+
uint fileInfoSize = reader.ReadUInt32();
59+
uint totalFileSize = reader.ReadUInt32();
60+
uint languageSize = reader.ReadUInt32();
61+
uint unknown1 = reader.ReadUInt32();
62+
uint unknown2 = reader.ReadUInt32();
63+
uint numFiles = reader.ReadUInt32();
64+
reader.ReadUInt32();
65+
reader.ReadUInt32();
66+
reader.ReadUInt32();
67+
reader.ReadUInt32();
68+
uint languageOffset = reader.ReadUInt32();
69+
uint fileInfoOffset = reader.ReadUInt32();
70+
uint stringTableOffset = reader.ReadUInt32();
71+
uint firstFileOffset = reader.ReadUInt32();
72+
73+
reader.SeekBegin(fileInfoOffset);
74+
for (int i = 0; i < numFiles; i++)
75+
{
76+
uint fileNameOffset = reader.ReadUInt32();
77+
uint fileNameHash = reader.ReadUInt32();
78+
uint fileExtOffset = reader.ReadUInt32();
79+
uint fileExtHash = reader.ReadUInt32();
80+
uint dataOffset = reader.ReadUInt32();
81+
uint dataSize = reader.ReadUInt32();
82+
uint compressedSize = reader.ReadUInt32();
83+
uint compressedSize2 = reader.ReadUInt32();
84+
uint padding1 = reader.ReadUInt32();
85+
uint padding2 = reader.ReadUInt32();
86+
uint compressionFlags = reader.ReadUInt32();
87+
uint padding3 = reader.ReadUInt32();
88+
89+
string fileName = GetString(reader, fileNameOffset);
90+
string ext = GetString(reader, fileExtOffset);
91+
92+
using (reader.TemporarySeek(dataOffset, System.IO.SeekOrigin.Begin))
93+
{
94+
byte[] data = reader.ReadBytes((int)compressedSize);
95+
var fileEntry = new FileEntry();
96+
fileEntry.FileName = $"{fileName}";
97+
fileEntry.Compressed = dataSize != compressedSize;
98+
if (fileEntry.Compressed)
99+
data = STLibraryCompression.ZLIB.Decompress(data);
100+
101+
fileEntry.SetData(data);
102+
files.Add(fileEntry);
103+
}
104+
}
105+
}
106+
}
107+
108+
private string GetString(FileReader reader, uint offset)
109+
{
110+
using (reader.TemporarySeek(offset, System.IO.SeekOrigin.Begin)) {
111+
return reader.ReadZeroTerminatedString();
112+
}
113+
}
114+
115+
public bool AddFile(ArchiveFileInfo archiveFileInfo)
116+
{
117+
return false;
118+
}
119+
120+
public bool DeleteFile(ArchiveFileInfo archiveFileInfo)
121+
{
122+
return false;
123+
}
124+
125+
public void Save(System.IO.Stream stream)
126+
{
127+
}
128+
129+
public class FileEntry : ArchiveFileInfo
130+
{
131+
public bool Compressed { get; set; }
132+
}
133+
}
134+
}

0 commit comments

Comments
 (0)