mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-25 01:49:20 +01:00
Add IpcPending.
This commit is contained in:
parent
960548f7b2
commit
eb7cc6ffa0
3 changed files with 26 additions and 6 deletions
|
|
@ -96,6 +96,11 @@ public sealed unsafe class MaterialManager : IRequiredService, IDisposable
|
|||
state.Materials.UpdateValue(idx, new MaterialValueState(newGame, materialValue.Model, drawData, StateSource.Manual),
|
||||
out _);
|
||||
break;
|
||||
case StateSource.IpcPending:
|
||||
materialValue.Model.Apply(ref row);
|
||||
state.Materials.UpdateValue(idx, new MaterialValueState(newGame, materialValue.Model, drawData, StateSource.IpcManual),
|
||||
out _);
|
||||
break;
|
||||
case StateSource.IpcManual:
|
||||
case StateSource.Manual:
|
||||
deleteList.Add(idx);
|
||||
|
|
|
|||
|
|
@ -800,6 +800,12 @@ public class StateListener : IDisposable
|
|||
if (_config.UseAdvancedParameters)
|
||||
model.ApplySingleParameterData(flag, state.ModelData.Parameters);
|
||||
break;
|
||||
case StateSource.IpcPending:
|
||||
state.BaseData.Parameters.Set(flag, newValue);
|
||||
state.Sources[flag] = StateSource.IpcManual;
|
||||
if (_config.UseAdvancedParameters)
|
||||
model.ApplySingleParameterData(flag, state.ModelData.Parameters);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,9 @@ public enum StateSource : byte
|
|||
IpcFixed,
|
||||
IpcManual,
|
||||
|
||||
// Only used for CustomizeParameters.
|
||||
// Only used for CustomizeParameters and advanced dyes.
|
||||
Pending,
|
||||
IpcPending,
|
||||
}
|
||||
|
||||
public static class StateSourceExtensions
|
||||
|
|
@ -19,7 +20,8 @@ public static class StateSourceExtensions
|
|||
public static StateSource Base(this StateSource source)
|
||||
=> source switch
|
||||
{
|
||||
StateSource.Manual or StateSource.IpcManual or StateSource.Pending => StateSource.Manual,
|
||||
StateSource.Manual or StateSource.Pending => StateSource.Manual,
|
||||
StateSource.IpcManual or StateSource.IpcPending => StateSource.Manual,
|
||||
StateSource.Fixed or StateSource.IpcFixed => StateSource.Fixed,
|
||||
_ => StateSource.Game,
|
||||
};
|
||||
|
|
@ -34,7 +36,12 @@ public static class StateSourceExtensions
|
|||
=> source.Base() is StateSource.Fixed;
|
||||
|
||||
public static StateSource SetPending(this StateSource source)
|
||||
=> source is StateSource.Manual ? StateSource.Pending : source;
|
||||
=> source switch
|
||||
{
|
||||
StateSource.Manual => StateSource.Pending,
|
||||
StateSource.IpcManual => StateSource.IpcPending,
|
||||
_ => source,
|
||||
};
|
||||
|
||||
public static bool RequiresChange(this StateSource source)
|
||||
=> source switch
|
||||
|
|
@ -46,7 +53,7 @@ public static class StateSourceExtensions
|
|||
};
|
||||
|
||||
public static bool IsIpc(this StateSource source)
|
||||
=> source is StateSource.IpcManual or StateSource.IpcFixed;
|
||||
=> source is StateSource.IpcManual or StateSource.IpcFixed or StateSource.IpcPending;
|
||||
}
|
||||
|
||||
public unsafe struct StateSources
|
||||
|
|
@ -97,6 +104,7 @@ public unsafe struct StateSources
|
|||
case (byte)StateSource.Manual | ((byte)StateSource.Fixed << 4):
|
||||
case (byte)StateSource.IpcFixed | ((byte)StateSource.Fixed << 4):
|
||||
case (byte)StateSource.Pending | ((byte)StateSource.Fixed << 4):
|
||||
case (byte)StateSource.IpcPending | ((byte)StateSource.Fixed << 4):
|
||||
case (byte)StateSource.IpcManual | ((byte)StateSource.Fixed << 4):
|
||||
_data[i] = (byte)((value & 0x0F) | ((byte)StateSource.Manual << 4));
|
||||
break;
|
||||
|
|
@ -104,6 +112,7 @@ public unsafe struct StateSources
|
|||
case ((byte)StateSource.Manual << 4) | (byte)StateSource.Fixed:
|
||||
case ((byte)StateSource.IpcFixed << 4) | (byte)StateSource.Fixed:
|
||||
case ((byte)StateSource.Pending << 4) | (byte)StateSource.Fixed:
|
||||
case ((byte)StateSource.IpcPending << 4) | (byte)StateSource.Fixed:
|
||||
case ((byte)StateSource.IpcManual << 4) | (byte)StateSource.Fixed:
|
||||
_data[i] = (byte)((value & 0xF0) | (byte)StateSource.Manual);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue