Coordinator-directed final cleanup before the user gate; none behavioral: 1. MeshExtractor public surface narrowed to the cross-assembly entry points App actually calls (PrepareMeshData, PrepareCellStructMeshData, CollectParts, ComputeBounds); PrepareSetupMeshData, CollectEmittersFromScript, PrepareGfxObjMeshData, PrepareEnvCellMeshData, PrepareCellStructEdgeLineData back to private (internal dispatch, only reached via PrepareMeshData). 2. sideStagedSink constructor parameter is now REQUIRED (no default; type stays nullable for a conscious null): a bake tool that forgot the sink would silently lose particle-preload meshes. 3. AcDream.Content.csproj gains TreatWarningsAsErrors + LangVersion latest (parity with AcDream.Core.csproj). Surfaced zero warnings. 4. Dead usings removed from ObjectMeshManager.cs (BCnEncoder.*, SixLabors.*) — the inline decode moved out in Task 4. 5. Doc fixes: ObjectMeshData.cs cross-assembly <see cref> -> plain text (Content can't resolve App types); IDatReaderWriter.cs stale Phase O-T7 'both in this namespace' sentence rewritten. 6. Stale test doc comments updated to MeshExtractor.PrepareGfxObjMeshData (StipplingSurfaceEquivalenceTests, Issue119UpNullGfxObjDumpTests) — comments only, no code/assertion changes. dotnet build green (0 warnings in Content under warnings-as-errors); full test suite 4059 passed / 0 failed / 4 skipped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
120 lines
4.1 KiB
C#
120 lines
4.1 KiB
C#
using DatReaderWriter;
|
|
using DatReaderWriter.Enums;
|
|
using DatReaderWriter.Lib.IO;
|
|
using System.Collections.ObjectModel;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
// Phase O-T7: verbatim copy of WorldBuilder.Shared.Services.IDatReaderWriter +
|
|
// IDatDatabase, taken into our tree so the WorldBuilder.Shared project
|
|
// reference could be dropped.
|
|
//
|
|
// MP1a (2026-07-05, Task 4): moved to AcDream.Content, namespace only —
|
|
// MeshExtractor's constructor takes IDatReaderWriter and must be GL-free.
|
|
// Consumers: MeshExtractor (this assembly) reads through it;
|
|
// DatCollectionAdapter (the concrete DatCollection-backed implementation)
|
|
// and ObjectMeshManager live in AcDream.App and implement/hold it from there.
|
|
|
|
namespace AcDream.Content;
|
|
|
|
/// <summary>
|
|
/// Interface for the dat reader/writer
|
|
/// </summary>
|
|
public interface IDatReaderWriter : IDisposable {
|
|
/// <summary>
|
|
/// Gets the source directory of the DAT files.
|
|
/// </summary>
|
|
string SourceDirectory { get; }
|
|
|
|
/// <summary>
|
|
/// Tries to get the raw bytes of a file from a specific region database.
|
|
/// </summary>
|
|
bool TryGetFileBytes(uint regionId, uint fileId, ref byte[] bytes, out int bytesRead);
|
|
|
|
/// <summary>
|
|
/// The portal database
|
|
/// </summary>
|
|
IDatDatabase Portal { get; }
|
|
|
|
/// <summary>
|
|
/// The cell region databases. Each key is a cell region ID
|
|
/// </summary>
|
|
ReadOnlyDictionary<uint, IDatDatabase> CellRegions { get; }
|
|
|
|
/// <summary>
|
|
/// The high res database
|
|
/// </summary>
|
|
IDatDatabase HighRes { get; }
|
|
|
|
/// <summary>
|
|
/// The language database
|
|
/// </summary>
|
|
IDatDatabase Language { get; }
|
|
|
|
/// <summary>
|
|
/// A mapping of region ids to region dat file entry ids. key: region id, value: region dat file entry
|
|
/// </summary>
|
|
ReadOnlyDictionary<uint, uint> RegionFileMap { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the current portal iteration.
|
|
/// </summary>
|
|
int PortalIteration { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the current cell iteration (from the first cell region).
|
|
/// </summary>
|
|
int CellIteration { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the current high res iteration.
|
|
/// </summary>
|
|
int HighResIteration { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the current language iteration.
|
|
/// </summary>
|
|
int LanguageIteration { get; }
|
|
|
|
// Write-path methods — preserved from WB's interface for verbatim
|
|
// compatibility but not exercised by ObjectMeshManager in acdream.
|
|
/// <summary>Attempts to save a database object to the appropriate DAT.</summary>
|
|
bool TrySave<T>(T obj, int iteration = 0) where T : IDBObj;
|
|
|
|
/// <summary>Attempts to save a database object to the appropriate DAT for a specific region.</summary>
|
|
bool TrySave<T>(uint regionId, T obj, int iteration = 0) where T : IDBObj;
|
|
|
|
/// <summary>
|
|
/// Resolution of a data ID to a database and type
|
|
/// </summary>
|
|
public record IdResolution(IDatDatabase Database, DBObjType Type);
|
|
|
|
/// <summary>
|
|
/// Resolves a data ID to all possible databases and types.
|
|
/// </summary>
|
|
public IEnumerable<IdResolution> ResolveId(uint id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Interface for a dat database, providing methods to retrieve files and objects.
|
|
/// </summary>
|
|
public interface IDatDatabase : IDisposable {
|
|
DatDatabase Db { get; }
|
|
|
|
/// <summary>Retrieves the current iteration of the database.</summary>
|
|
int Iteration { get; }
|
|
|
|
/// <summary>Retrieves all file IDs of a specific type.</summary>
|
|
public IEnumerable<uint> GetAllIdsOfType<T>() where T : IDBObj;
|
|
|
|
/// <summary>Attempts to retrieve a database object by its file ID.</summary>
|
|
public bool TryGet<T>(uint fileId, [MaybeNullWhen(false)] out T value) where T : IDBObj;
|
|
|
|
/// <summary>Attempts to retrieve the raw bytes of a file by its ID.</summary>
|
|
bool TryGetFileBytes(uint fileId, [MaybeNullWhen(false)] out byte[] value);
|
|
|
|
/// <summary>Attempts to retrieve the raw bytes of a file by its ID into a provided buffer.</summary>
|
|
bool TryGetFileBytes(uint fileId, ref byte[] bytes, out int bytesRead);
|
|
|
|
/// <summary>Attempts to save a database object.</summary>
|
|
bool TrySave<T>(T obj, int iteration = 0) where T : IDBObj;
|
|
}
|