mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Make StainService deal with early-loading.
This commit is contained in:
parent
a585976190
commit
2534f119e9
1 changed files with 21 additions and 8 deletions
|
|
@ -16,7 +16,8 @@ namespace Penumbra.Services;
|
||||||
public class StainService : IService
|
public class StainService : IService
|
||||||
{
|
{
|
||||||
public sealed class StainTemplateCombo<TDyePack>(FilterComboColors[] stainCombos, StmFile<TDyePack> stmFile)
|
public sealed class StainTemplateCombo<TDyePack>(FilterComboColors[] stainCombos, StmFile<TDyePack> stmFile)
|
||||||
: FilterComboCache<ushort>(stmFile.Entries.Keys.Prepend((ushort)0), MouseWheelType.None, Penumbra.Log) where TDyePack : unmanaged, IDyePack
|
: FilterComboCache<ushort>(stmFile.Entries.Keys.Prepend((ushort)0), MouseWheelType.None, Penumbra.Log)
|
||||||
|
where TDyePack : unmanaged, IDyePack
|
||||||
{
|
{
|
||||||
// FIXME There might be a better way to handle that.
|
// FIXME There might be a better way to handle that.
|
||||||
public int CurrentDyeChannel = 0;
|
public int CurrentDyeChannel = 0;
|
||||||
|
|
@ -83,8 +84,18 @@ public class StainService : IService
|
||||||
StainData = stainData;
|
StainData = stainData;
|
||||||
StainCombo1 = CreateStainCombo();
|
StainCombo1 = CreateStainCombo();
|
||||||
StainCombo2 = CreateStainCombo();
|
StainCombo2 = CreateStainCombo();
|
||||||
|
|
||||||
|
if (characterUtility.Address == null)
|
||||||
|
{
|
||||||
|
LegacyStmFile = LoadStmFile<LegacyDyePack>(null, dataManager);
|
||||||
|
GudStmFile = LoadStmFile<DyePack>(null, dataManager);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
LegacyStmFile = LoadStmFile<LegacyDyePack>(characterUtility.Address->LegacyStmResource, dataManager);
|
LegacyStmFile = LoadStmFile<LegacyDyePack>(characterUtility.Address->LegacyStmResource, dataManager);
|
||||||
GudStmFile = LoadStmFile<DyePack>(characterUtility.Address->GudStmResource, dataManager);
|
GudStmFile = LoadStmFile<DyePack>(characterUtility.Address->GudStmResource, dataManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FilterComboColors[] stainCombos = [StainCombo1, StainCombo2];
|
FilterComboColors[] stainCombos = [StainCombo1, StainCombo2];
|
||||||
|
|
||||||
|
|
@ -98,11 +109,13 @@ public class StainService : IService
|
||||||
{
|
{
|
||||||
0 => StainCombo1,
|
0 => StainCombo1,
|
||||||
1 => StainCombo2,
|
1 => StainCombo2,
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(channel), channel, $"Unsupported dye channel {channel} (supported values are 0 and 1)")
|
_ => throw new ArgumentOutOfRangeException(nameof(channel), channel,
|
||||||
|
$"Unsupported dye channel {channel} (supported values are 0 and 1)"),
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary> Loads a STM file. Opportunistically attempts to re-use the file already read by the game, with Lumina fallback. </summary>
|
/// <summary> Loads a STM file. Opportunistically attempts to re-use the file already read by the game, with Lumina fallback. </summary>
|
||||||
private static unsafe StmFile<TDyePack> LoadStmFile<TDyePack>(ResourceHandle* stmResourceHandle, IDataManager dataManager) where TDyePack : unmanaged, IDyePack
|
private static unsafe StmFile<TDyePack> LoadStmFile<TDyePack>(ResourceHandle* stmResourceHandle, IDataManager dataManager)
|
||||||
|
where TDyePack : unmanaged, IDyePack
|
||||||
{
|
{
|
||||||
if (stmResourceHandle != null)
|
if (stmResourceHandle != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue