mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-24 01:19:22 +01:00
Maybe fix migration for metadata containing mods, also fix negative values in mod collection settings causing problems.
This commit is contained in:
parent
7409d0bc2f
commit
3b2876a6e4
3 changed files with 15 additions and 5 deletions
|
|
@ -70,6 +70,8 @@ public partial class Configuration
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the right meta files are loaded.
|
||||||
|
Penumbra.CharacterUtility.LoadCharacterResources();
|
||||||
ResettleSortOrder();
|
ResettleSortOrder();
|
||||||
ResettleCollectionSettings();
|
ResettleCollectionSettings();
|
||||||
ResettleForcedCollection();
|
ResettleForcedCollection();
|
||||||
|
|
@ -180,8 +182,8 @@ public partial class Configuration
|
||||||
var modName = ( string )setting[ "FolderName" ]!;
|
var modName = ( string )setting[ "FolderName" ]!;
|
||||||
var enabled = ( bool )setting[ "Enabled" ]!;
|
var enabled = ( bool )setting[ "Enabled" ]!;
|
||||||
var priority = ( int )setting[ "Priority" ]!;
|
var priority = ( int )setting[ "Priority" ]!;
|
||||||
var settings = setting[ "Settings" ]!.ToObject< Dictionary< string, uint > >()
|
var settings = setting[ "Settings" ]!.ToObject< Dictionary< string, long > >()
|
||||||
?? setting[ "Conf" ]!.ToObject< Dictionary< string, uint > >();
|
?? setting[ "Conf" ]!.ToObject< Dictionary< string, long > >();
|
||||||
|
|
||||||
dict[ modName ] = new ModSettings.SavedSettings()
|
dict[ modName ] = new ModSettings.SavedSettings()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,13 @@ public unsafe class CharacterUtility : IDisposable
|
||||||
[Signature( "48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? 00 48 8D 8E ?? ?? 00 00 E8 ?? ?? ?? 00 33 D2", ScanType = ScanType.StaticAddress )]
|
[Signature( "48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? 00 48 8D 8E ?? ?? 00 00 E8 ?? ?? ?? 00 33 D2", ScanType = ScanType.StaticAddress )]
|
||||||
private readonly Structs.CharacterUtility** _characterUtilityAddress = null;
|
private readonly Structs.CharacterUtility** _characterUtilityAddress = null;
|
||||||
|
|
||||||
|
// Only required for migration anymore.
|
||||||
|
[Signature( "E8 ?? ?? ?? 00 48 8D 8E ?? ?? 00 00 E8 ?? ?? ?? 00 33 D2" )]
|
||||||
|
public readonly Action< IntPtr >? LoadCharacterResourcesFunc;
|
||||||
|
|
||||||
|
public void LoadCharacterResources()
|
||||||
|
=> LoadCharacterResourcesFunc?.Invoke( ( IntPtr )_characterUtilityAddress );
|
||||||
|
|
||||||
public Structs.CharacterUtility* Address
|
public Structs.CharacterUtility* Address
|
||||||
=> *_characterUtilityAddress;
|
=> *_characterUtilityAddress;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ public class ModSettings
|
||||||
// A simple struct conversion to easily save settings by name instead of value.
|
// A simple struct conversion to easily save settings by name instead of value.
|
||||||
public struct SavedSettings
|
public struct SavedSettings
|
||||||
{
|
{
|
||||||
public Dictionary< string, uint > Settings;
|
public Dictionary< string, long > Settings;
|
||||||
public int Priority;
|
public int Priority;
|
||||||
public bool Enabled;
|
public bool Enabled;
|
||||||
|
|
||||||
|
|
@ -165,7 +165,7 @@ public class ModSettings
|
||||||
{
|
{
|
||||||
Priority = settings.Priority;
|
Priority = settings.Priority;
|
||||||
Enabled = settings.Enabled;
|
Enabled = settings.Enabled;
|
||||||
Settings = new Dictionary< string, uint >( mod.Groups.Count );
|
Settings = new Dictionary< string, long >( mod.Groups.Count );
|
||||||
settings.AddMissingSettings( mod.Groups.Count );
|
settings.AddMissingSettings( mod.Groups.Count );
|
||||||
|
|
||||||
foreach( var (group, setting) in mod.Groups.Zip( settings.Settings ) )
|
foreach( var (group, setting) in mod.Groups.Zip( settings.Settings ) )
|
||||||
|
|
@ -183,7 +183,8 @@ public class ModSettings
|
||||||
{
|
{
|
||||||
if( Settings.TryGetValue( group.Name, out var config ) )
|
if( Settings.TryGetValue( group.Name, out var config ) )
|
||||||
{
|
{
|
||||||
var actualConfig = FixSetting( group, config );
|
var castConfig = ( uint )Math.Clamp( config, 0, uint.MaxValue );
|
||||||
|
var actualConfig = FixSetting( group, castConfig );
|
||||||
list.Add( actualConfig );
|
list.Add( actualConfig );
|
||||||
if( actualConfig != config )
|
if( actualConfig != config )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue