Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Pull in what we have for Xande so far #67

Merged
merged 3 commits into from
Sep 11, 2023
Merged

Pull in what we have for Xande so far #67

merged 3 commits into from
Sep 11, 2023

Conversation

NotNite
Copy link
Collaborator

@NotNite NotNite commented Jun 26, 2023

I'm being harassed by people in the Penumbra Discord to work on Xande again so that means this needs to be merged. Is it finished? Who knows!

@@ -206,6 +207,7 @@ public GameData( string dataPath, ILogger logger, LuminaOptions? options = null!

var file = Activator.CreateInstance< T >();
file.Data = fileContent;
if( origPath != null ) file.FilePath = ParseFilePath( origPath )!;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always use curly braces

@@ -93,7 +93,7 @@ private void BuildModel()
ReadStrings();
ReadMaterials();
ReadMeshes();
ReadShapes();
ReadShapes(Meshes);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting

@@ -127,14 +127,19 @@ private void ReadMaterials()
}
}

private void ReadShapes()
private void ReadShapes(IReadOnlyList<Mesh> meshes )
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting

public string ShapeName { get; private set; }
public struct ShapeMesh {
public Mesh AssociatedMesh;
public (ushort BaseIndicesIndex, ushort ReplacedVertexIndex)[] Values;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wtf tier spacing

public static IReadOnlyList< ShapeMesh > ConstructList( MdlFile file, IReadOnlyList<Mesh> meshes )
{
var ret = new ShapeMesh[file.ModelHeader.ShapeMeshCount];
var idx = 0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wtf tier spacing

Name = model.StringOffsetToStringMap[ (int) currentShape.StringOffset ];
Meshes = new ShapeMesh[currentShape.ShapeMeshCount[ (int) lod ]];
var end = currentShape.ShapeMeshCount[(int)lod];
var offset = currentShape.ShapeMeshStartIndex[(int)lod];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting

public ushort Offset;
public ushort Value;
public ushort BaseIndicesIndex; // PROBABLY: Index into the Indices array of a mesh.
public ushort ReplacingVertexIndex; // PROBABLY: Index into the (without transformation probably unused) vertex of a mesh.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there probs should be obsolete backing fields for this but i dont know if i care

@@ -337,15 +337,15 @@ public static ShapeStruct Read( LuminaBinaryReader br )

public struct ShapeMeshStruct
{
public uint StartIndex;
public uint MeshIndexOffset; // from TT: The offset to the index block this Shape Data should be replacing in. -- This is how Shape Data is tied to each mesh.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this as a doc comment not a normal comment

public ushort Offset;
public ushort Value;
public ushort BaseIndicesIndex; // PROBABLY: Index into the Indices array of a mesh.
public ushort ReplacingVertexIndex; // PROBABLY: Index into the (without transformation probably unused) vertex of a mesh.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc comments here too


public Shape(Model model, int shapeIndex)
public Shape(Model model, Model.ModelLod lod, IReadOnlyList<ShapeMesh> shapeMeshes, int shapeIndex)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting

/// <typeparam name="T">The type of <see cref="FileResource"/> to load the raw file in to</typeparam>
/// <returns>The requested file if found, null if not</returns>
/// <exception cref="FileNotFoundException">The path given doesn't point to an existing file</exception>
public T GetFileFromDisk< T >( string path ) where T : FileResource
public T GetFileFromDisk< T >( string path, string? origPath = null ) where T : FileResource
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if that's a concern, but this breaks backwards compatibility by the way.

IIRC, creating Func<string, T> delegates out of this method won't work any more, also the code that depends on it will need a recompile.

@NotAdam NotAdam merged commit 2e08df7 into master Sep 11, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants