Bug fixes.

This commit is contained in:
Max 2022-12-27 06:36:50 -06:00
parent 7710cfba59
commit 4a360e4033
15 changed files with 126 additions and 64 deletions

View File

@ -328,23 +328,8 @@ namespace RobloxFiles.BinaryFormat.Chunks
{ {
// Make sure this value is in a safe range. // Make sure this value is in a safe range.
int orientId = (rawOrientId - 1) % 36; int orientId = (rawOrientId - 1) % 36;
var cf = CFrame.FromOrientId(orientId);
NormalId xColumn = (NormalId)(orientId / 6); matrices[i] = cf.GetComponents();
Vector3 R0 = Vector3.FromNormalId(xColumn);
NormalId yColumn = (NormalId)(orientId % 6);
Vector3 R1 = Vector3.FromNormalId(yColumn);
// Compute R2 using the cross product of R0 and R1.
Vector3 R2 = R0.Cross(R1);
// Generate the rotation matrix.
matrices[i] = new float[9]
{
R0.X, R0.Y, R0.Z,
R1.X, R1.Y, R1.Z,
R2.X, R2.Y, R2.Z,
};
} }
else if (Type == PropertyType.Quaternion) else if (Type == PropertyType.Quaternion)
{ {

View File

@ -1,4 +1,5 @@
using System; using RobloxFiles.Enums;
using System;
using System.Diagnostics.Contracts; using System.Diagnostics.Contracts;
namespace RobloxFiles.DataTypes namespace RobloxFiles.DataTypes
@ -447,5 +448,25 @@ namespace RobloxFiles.DataTypes
return orientId; return orientId;
} }
internal static CFrame FromOrientId(int orientId)
{
var xColumn = (NormalId)(orientId / 6);
var yColumn = (NormalId)(orientId % 6);
var R0 = Vector3.FromNormalId(xColumn);
var R1 = Vector3.FromNormalId(yColumn);
var R2 = R0.Cross(R1);
var matrix = new float[12]
{
0, 0, 0,
R0.X, R0.Y, R0.Z,
R1.X, R1.Y, R1.Z,
R2.X, R2.Y, R2.Z
};
return new CFrame(matrix);
}
} }
} }

View File

@ -4318,6 +4318,24 @@ namespace RobloxFiles
{ {
} }
public class BubbleChatConfiguration : TextChatConfigurations
{
public string AdorneeName = "HumanoidRootPart";
public Color3 BackgroundColor3 = Color3.FromRGB(250, 250, 250);
public double BackgroundTransparency = 0.1;
public float BubbleDuration = 15;
public float BubblesSpacing = 6;
public bool Enabled = true;
public Font Font = Font.GothamMedium;
public FontFace FontFace = FontFace.FromEnum(Enums.Font.GothamMedium);
public Vector3 LocalPlayerStudsOffset = Vector3.zero;
public float MaxDistance = 100;
public float MinimizeDistance = 40;
public Color3 TextColor3 = Color3.FromRGB(57, 59, 61);
public long TextSize = 16;
public float VerticalStudsOffset = 0;
}
public class ChatInputBarConfiguration : TextChatConfigurations public class ChatInputBarConfiguration : TextChatConfigurations
{ {
public Color3 BackgroundColor3 = Color3.FromRGB(25, 27, 29); public Color3 BackgroundColor3 = Color3.FromRGB(25, 27, 29);

View File

@ -1,28 +0,0 @@
{
"version": "2.0.0",
"tasks":
[
{
"type": "shell",
"label": "Build Plugin",
"command": "rojo build --output GenerateApiDump.rbxm",
"group": "build"
},
{
"type": "shell",
"label": "Build and Test Plugin",
"command": "powershell -ExecutionPolicy ByPass -File DeployToStudio.ps1",
"dependsOn": ["Build Plugin"],
"group":
{
"kind": "build",
"isDefault": true
}
}
]
}

View File

@ -1,4 +0,0 @@
$pluginName = "GenerateApiDump.rbxm"
$destPath = "$env:localappdata\Roblox\Plugins\" + $pluginName
Copy-Item -Path $pluginName -Destination $destPath

Binary file not shown.

View File

@ -14,6 +14,7 @@ local singletons = {
ParabolaAdornment = Instance.new("BoxHandleAdornment"), -- close enough ParabolaAdornment = Instance.new("BoxHandleAdornment"), -- close enough
StarterPlayerScripts = StarterPlayer:WaitForChild("StarterPlayerScripts"), StarterPlayerScripts = StarterPlayer:WaitForChild("StarterPlayerScripts"),
StarterCharacterScripts = StarterPlayer:WaitForChild("StarterCharacterScripts"), StarterCharacterScripts = StarterPlayer:WaitForChild("StarterCharacterScripts"),
BubbleChatConfiguration = TextChatService:WaitForChild("BubbleChatConfiguration", 10),
ChatWindowConfiguration = TextChatService:WaitForChild("ChatWindowConfiguration", 10), ChatWindowConfiguration = TextChatService:WaitForChild("ChatWindowConfiguration", 10),
ChatInputBarConfiguration = TextChatService:WaitForChild("ChatInputBarConfiguration", 10), ChatInputBarConfiguration = TextChatService:WaitForChild("ChatInputBarConfiguration", 10),
} }

2
Plugins/make Normal file
View File

@ -0,0 +1,2 @@
#!/bin/sh
rojo build --output $LOCALAPPDATA/Roblox/Plugins/GenerateApiDump.rbxm

Binary file not shown.

View File

@ -1,12 +1,23 @@
using System.Xml; using System;
using System.Runtime.Remoting.Messaging;
using System.Xml;
using RobloxFiles.DataTypes; using RobloxFiles.DataTypes;
using RobloxFiles.Enums;
namespace RobloxFiles.Tokens namespace RobloxFiles.Tokens
{ {
public class CFrameToken : IXmlPropertyToken public class CFrameToken : IXmlPropertyToken, IAttributeToken<CFrame>
{ {
public string XmlPropertyToken => "CoordinateFrame; CFrame"; public string XmlPropertyToken => "CoordinateFrame; CFrame";
private static readonly string[] Coords = new string[12] { "X", "Y", "Z", "R00", "R01", "R02", "R10", "R11", "R12", "R20", "R21", "R22"}; public AttributeType AttributeType => AttributeType.CFrame;
private static readonly string[] Coords = new string[12]
{
"X", "Y", "Z",
"R00", "R01", "R02",
"R10", "R11", "R12",
"R20", "R21", "R22"
};
public static CFrame ReadCFrame(XmlNode token) public static CFrame ReadCFrame(XmlNode token)
{ {
@ -65,5 +76,52 @@ namespace RobloxFiles.Tokens
CFrame value = prop.Value as CFrame; CFrame value = prop.Value as CFrame;
WriteCFrame(value, doc, node); WriteCFrame(value, doc, node);
} }
public CFrame ReadAttribute(RbxAttribute attribute)
{
float x = attribute.ReadFloat(),
y = attribute.ReadFloat(),
z = attribute.ReadFloat();
var rawOrientId = attribute.ReadByte();
var pos = new Vector3(x, y, z);
if (rawOrientId > 0)
{
int orientId = (rawOrientId - 1) % 36;
return CFrame.FromOrientId(orientId) + pos;
}
else
{
float[] matrix = new float[12];
for (int i = 3; i < 12; i++)
matrix[i] = attribute.ReadFloat();
return new CFrame(matrix) + pos;
}
}
public void WriteAttribute(RbxAttribute attribute, CFrame value)
{
Vector3 pos = value.Position;
attribute.WriteFloat(pos.X);
attribute.WriteFloat(pos.Y);
attribute.WriteFloat(pos.Z);
int orientId = value.GetOrientId();
attribute.WriteByte((byte)(orientId + 1));
if (orientId == -1)
{
float[] components = value.GetComponents();
for (int i = 3; i < 12; i++)
{
float component = components[i];
attribute.WriteFloat(component);
}
}
}
} }
} }

View File

@ -1,8 +1,8 @@
using System; using System;
using System.Diagnostics.Contracts; using System.Diagnostics.Contracts;
using System.Reflection;
using System.Xml; using System.Xml;
using RobloxFiles.Utility;
using RobloxFiles.XmlFormat; using RobloxFiles.XmlFormat;
namespace RobloxFiles.Tokens namespace RobloxFiles.Tokens
@ -19,12 +19,11 @@ namespace RobloxFiles.Tokens
{ {
Instance inst = prop.Instance; Instance inst = prop.Instance;
Type instType = inst?.GetType(); Type instType = inst?.GetType();
var info = ImplicitMember.Get(instType, prop.Name);
FieldInfo info = instType.GetField(prop.Name, Property.BindingFlags);
if (info != null) if (info != null)
{ {
Type enumType = info.FieldType; Type enumType = info.MemberType;
string item = value.ToInvariantString(); string item = value.ToInvariantString();
prop.Type = PropertyType.Enum; prop.Type = PropertyType.Enum;

View File

@ -42,16 +42,19 @@ namespace RobloxFiles.Tokens
var weight = (uint)font.Weight; var weight = (uint)font.Weight;
string family = font.Family; string family = font.Family;
string contentType = "null"; string familyType = "null";
string cachedType = "null";
string cachedId = font.CachedFaceId;
if (family.Length > 0) if (family.Length > 0)
contentType = "url"; familyType = "url";
var contentNode = doc.CreateElement(contentType); if (cachedId.Length > 0)
contentNode.InnerText = family; cachedType = "url";
var familyNode = doc.CreateElement("Family"); var familyNode = doc.CreateElement("Family");
familyNode.AppendChild(contentNode); familyNode.InnerText = $"<{familyType}>{family}</{familyType}>";
node.AppendChild(familyNode); node.AppendChild(familyNode);
var weightNode = doc.CreateElement("Weight"); var weightNode = doc.CreateElement("Weight");
@ -61,6 +64,10 @@ namespace RobloxFiles.Tokens
var styleNode = doc.CreateElement("Style"); var styleNode = doc.CreateElement("Style");
styleNode.InnerText = $"{font.Style}"; styleNode.InnerText = $"{font.Style}";
node.AppendChild(styleNode); node.AppendChild(styleNode);
var cacheNode = doc.CreateElement("CachedFaceId");
cacheNode.InnerText = $"<{cachedType}>{cachedId}</{cachedType}>";
node.AppendChild(cacheNode);
} }
public FontFace ReadAttribute(RbxAttribute attribute) public FontFace ReadAttribute(RbxAttribute attribute)

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.Serialization;
using System.Text; using System.Text;
namespace RobloxFiles namespace RobloxFiles
@ -33,7 +32,7 @@ namespace RobloxFiles
Vector3 = 17, Vector3 = 17,
// Vector2int16 = 18, // Vector2int16 = 18,
// Vector3int16 = 19, // Vector3int16 = 19,
// CFrame = 20, CFrame = 20,
// Enum = 21, // Enum = 21,
NumberSequence = 23, NumberSequence = 23,
// NumberSequenceKeypoint = 24, // NumberSequenceKeypoint = 24,
@ -154,6 +153,7 @@ namespace RobloxFiles
internal string ReadString() => Reader.ReadString(true); internal string ReadString() => Reader.ReadString(true);
internal void WriteInt(int value) => Writer.Write(value); internal void WriteInt(int value) => Writer.Write(value);
internal void WriteByte(byte value) => Writer.Write(value);
internal void WriteBool(bool value) => Writer.Write(value); internal void WriteBool(bool value) => Writer.Write(value);
internal void WriteFloat(float value) => Writer.Write(value); internal void WriteFloat(float value) => Writer.Write(value);
internal void WriteDouble(double value) => Writer.Write(value); internal void WriteDouble(double value) => Writer.Write(value);

View File

@ -45,6 +45,9 @@ namespace RobloxFiles
/// <summary>The source AssetId this instance was created in.</summary> /// <summary>The source AssetId this instance was created in.</summary>
public long SourceAssetId = -1; public long SourceAssetId = -1;
/// <summary>A unique identifier declared for the history of this instance.</summary>
public UniqueId HistoryId;
/// <summary>A unique identifier declared for this instance.</summary> /// <summary>A unique identifier declared for this instance.</summary>
public UniqueId UniqueId; public UniqueId UniqueId;

Binary file not shown.