Update to Lumina 5 (new Excel parsing) (#2022)

* Refactor and upgrade to new excel design

* Obsolete ExcelResolver<T> and use only RowRef<T>

* Better benchmarking for Lumina

* Add custom game-supported RSV provider

* Refactor and move Lazy<T> and nullable/cached row objects to RowRefs

* Convert IRSVProvider to delegate, resolve strings by default

* Split IExcelRow into IExcelSubrow

* Extra lumina documentation

* Minor RSV CS fixes

* Fix UIGlowPayload warning

* Fix rebase

* Update to Lumina 5
This commit is contained in:
Asriel Camora 2024-10-20 19:59:03 -07:00 committed by GitHub
parent 08d8605871
commit 0b9af0e3f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 460 additions and 403 deletions

View file

@ -11,6 +11,7 @@ using Dalamud.Utility.Timing;
using Lumina;
using Lumina.Data;
using Lumina.Excel;
using Newtonsoft.Json;
using Serilog;
@ -28,12 +29,15 @@ internal sealed class DataManager : IInternalDisposableService, IDataManager
{
private readonly Thread luminaResourceThread;
private readonly CancellationTokenSource luminaCancellationTokenSource;
private readonly RsvResolver rsvResolver;
[ServiceManager.ServiceConstructor]
private DataManager(Dalamud dalamud)
{
this.Language = (ClientLanguage)dalamud.StartInfo.Language;
this.rsvResolver = new();
try
{
Log.Verbose("Starting data load...");
@ -44,11 +48,8 @@ internal sealed class DataManager : IInternalDisposableService, IDataManager
{
LoadMultithreaded = true,
CacheFileResources = true,
#if NEVER // Lumina bug
PanicOnSheetChecksumMismatch = true,
#else
PanicOnSheetChecksumMismatch = false,
#endif
RsvResolver = this.rsvResolver.TryResolve,
DefaultExcelLanguage = this.Language.ToLumina(),
};
@ -129,12 +130,12 @@ internal sealed class DataManager : IInternalDisposableService, IDataManager
#region Lumina Wrappers
/// <inheritdoc/>
public ExcelSheet<T>? GetExcelSheet<T>() where T : ExcelRow
=> this.Excel.GetSheet<T>();
public ExcelSheet<T> GetExcelSheet<T>(ClientLanguage? language = null, string? name = null) where T : struct, IExcelRow<T>
=> this.Excel.GetSheet<T>(language?.ToLumina(), name);
/// <inheritdoc/>
public ExcelSheet<T>? GetExcelSheet<T>(ClientLanguage language) where T : ExcelRow
=> this.Excel.GetSheet<T>(language.ToLumina());
public SubrowExcelSheet<T> GetSubrowExcelSheet<T>(ClientLanguage? language = null, string? name = null) where T : struct, IExcelSubrow<T>
=> this.Excel.GetSubrowSheet<T>(language?.ToLumina(), name);
/// <inheritdoc/>
public FileResource? GetFile(string path)
@ -170,6 +171,7 @@ internal sealed class DataManager : IInternalDisposableService, IDataManager
{
this.luminaCancellationTokenSource.Cancel();
this.GameData.Dispose();
this.rsvResolver.Dispose();
}
private class LauncherTroubleshootingInfo