mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 20:24:17 +01:00
Add option to disable disabling sound streaming.
This commit is contained in:
parent
ac2f2cf3b9
commit
e18fcafc51
4 changed files with 584 additions and 533 deletions
|
|
@ -20,6 +20,7 @@ namespace Penumbra
|
||||||
|
|
||||||
public bool DisableFileSystemNotifications { get; set; }
|
public bool DisableFileSystemNotifications { get; set; }
|
||||||
|
|
||||||
|
public bool DisableSoundStreaming { get; set; } = true;
|
||||||
public bool EnableHttpApi { get; set; }
|
public bool EnableHttpApi { get; set; }
|
||||||
public bool EnablePlayerWatch { get; set; } = false;
|
public bool EnablePlayerWatch { get; set; } = false;
|
||||||
public int WaitFrames { get; set; } = 30;
|
public int WaitFrames { get; set; } = 30;
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ using Penumbra.Mod;
|
||||||
using Penumbra.Structs;
|
using Penumbra.Structs;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
namespace Penumbra.Mods
|
namespace Penumbra.Mods;
|
||||||
{
|
|
||||||
// The ModCollectionCache contains all required temporary data to use a collection.
|
// The ModCollectionCache contains all required temporary data to use a collection.
|
||||||
// It will only be setup if a collection gets activated in any way.
|
// It will only be setup if a collection gets activated in any way.
|
||||||
public class ModCollectionCache
|
public class ModCollectionCache
|
||||||
|
|
@ -77,8 +77,10 @@ namespace Penumbra.Mods
|
||||||
AddMetaFiles();
|
AddMetaFiles();
|
||||||
Checksums.Clear();
|
Checksums.Clear();
|
||||||
foreach( var file in ResolvedFiles )
|
foreach( var file in ResolvedFiles )
|
||||||
|
{
|
||||||
Checksums.Add( file.Value.Crc64 );
|
Checksums.Add( file.Value.Crc64 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SetChangedItems()
|
private void SetChangedItems()
|
||||||
{
|
{
|
||||||
|
|
@ -131,8 +133,27 @@ namespace Penumbra.Mods
|
||||||
AddRemainingFiles( mod );
|
AddRemainingFiles( mod );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool FilterFile( GamePath gamePath )
|
||||||
|
{
|
||||||
|
// If audio streaming is not disabled, replacing .scd files crashes the game,
|
||||||
|
// so only add those files if it is disabled.
|
||||||
|
if( !Penumbra.Config.DisableSoundStreaming
|
||||||
|
&& gamePath.ToString().EndsWith( ".scd", StringComparison.InvariantCultureIgnoreCase ) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void AddFile( Mod.Mod mod, GamePath gamePath, FullPath file )
|
private void AddFile( Mod.Mod mod, GamePath gamePath, FullPath file )
|
||||||
{
|
{
|
||||||
|
if( FilterFile( gamePath ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( !RegisteredFiles.TryGetValue( gamePath, out var oldMod ) )
|
if( !RegisteredFiles.TryGetValue( gamePath, out var oldMod ) )
|
||||||
{
|
{
|
||||||
RegisteredFiles.Add( gamePath, mod );
|
RegisteredFiles.Add( gamePath, mod );
|
||||||
|
|
@ -259,19 +280,19 @@ namespace Penumbra.Mods
|
||||||
|
|
||||||
private void AddSwaps( Mod.Mod mod )
|
private void AddSwaps( Mod.Mod mod )
|
||||||
{
|
{
|
||||||
foreach( var swap in mod.Data.Meta.FileSwaps )
|
foreach( var (key, value) in mod.Data.Meta.FileSwaps.Where( kvp => !FilterFile( kvp.Key ) ) )
|
||||||
{
|
{
|
||||||
if( !RegisteredFiles.TryGetValue( swap.Key, out var oldMod ) )
|
if( !RegisteredFiles.TryGetValue( key, out var oldMod ) )
|
||||||
{
|
{
|
||||||
RegisteredFiles.Add( swap.Key, mod );
|
RegisteredFiles.Add( key, mod );
|
||||||
SwappedFiles.Add( swap.Key, swap.Value );
|
SwappedFiles.Add( key, value );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mod.Cache.AddConflict( oldMod, swap.Key );
|
mod.Cache.AddConflict( oldMod, key );
|
||||||
if( !ReferenceEquals( mod, oldMod ) && mod.Settings.Priority == oldMod.Settings.Priority )
|
if( !ReferenceEquals( mod, oldMod ) && mod.Settings.Priority == oldMod.Settings.Priority )
|
||||||
{
|
{
|
||||||
oldMod.Cache.AddConflict( mod, swap.Key );
|
oldMod.Cache.AddConflict( mod, key );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -372,4 +393,3 @@ namespace Penumbra.Mods
|
||||||
public string? ResolveSwappedOrReplacementPath( GamePath gameResourcePath )
|
public string? ResolveSwappedOrReplacementPath( GamePath gameResourcePath )
|
||||||
=> GetCandidateForGameFile( gameResourcePath )?.FullName.Replace( '\\', '/' ) ?? GetSwappedFilePath( gameResourcePath ) ?? null;
|
=> GetCandidateForGameFile( gameResourcePath )?.FullName.Replace( '\\', '/' ) ?? GetSwappedFilePath( gameResourcePath ) ?? null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -14,8 +14,8 @@ using Penumbra.PlayerWatch;
|
||||||
using Penumbra.UI;
|
using Penumbra.UI;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
namespace Penumbra
|
namespace Penumbra;
|
||||||
{
|
|
||||||
public class Penumbra : IDalamudPlugin
|
public class Penumbra : IDalamudPlugin
|
||||||
{
|
{
|
||||||
public string Name { get; } = "Penumbra";
|
public string Name { get; } = "Penumbra";
|
||||||
|
|
@ -44,7 +44,10 @@ namespace Penumbra
|
||||||
Config = Configuration.Load();
|
Config = Configuration.Load();
|
||||||
|
|
||||||
MusicManager = new MusicManager();
|
MusicManager = new MusicManager();
|
||||||
|
if( Config.DisableSoundStreaming )
|
||||||
|
{
|
||||||
MusicManager.DisableStreaming();
|
MusicManager.DisableStreaming();
|
||||||
|
}
|
||||||
|
|
||||||
var gameUtils = Service< ResidentResources >.Set();
|
var gameUtils = Service< ResidentResources >.Set();
|
||||||
PlayerWatcher = PlayerWatchFactory.Create( Dalamud.Framework, Dalamud.ClientState, Dalamud.Objects );
|
PlayerWatcher = PlayerWatchFactory.Create( Dalamud.Framework, Dalamud.ClientState, Dalamud.Objects );
|
||||||
|
|
@ -254,4 +257,3 @@ namespace Penumbra
|
||||||
SettingsInterface.FlipVisibility();
|
SettingsInterface.FlipVisibility();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -194,6 +194,33 @@ public partial class SettingsInterface
|
||||||
"Instead of keeping the mod-selector in the Installed Mods tab a fixed width, this will let it scale with the total size of the Penumbra window." );
|
"Instead of keeping the mod-selector in the Installed Mods tab a fixed width, this will let it scale with the total size of the Penumbra window." );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawDisableSoundStreamingBox()
|
||||||
|
{
|
||||||
|
var tmp = Penumbra.Config.DisableSoundStreaming;
|
||||||
|
if( ImGui.Checkbox( "Disable Audio Streaming", ref tmp ) && tmp != Penumbra.Config.DisableSoundStreaming )
|
||||||
|
{
|
||||||
|
Penumbra.Config.DisableSoundStreaming = tmp;
|
||||||
|
_configChanged = true;
|
||||||
|
if( tmp )
|
||||||
|
{
|
||||||
|
_base._penumbra.MusicManager.DisableStreaming();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_base._penumbra.MusicManager.EnableStreaming();
|
||||||
|
}
|
||||||
|
|
||||||
|
_base.ReloadMods();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGuiComponents.HelpMarker(
|
||||||
|
"Disable streaming in the games audio engine.\n"
|
||||||
|
+ "If you do not disable streaming, you can not replace sound files in the game (*.scd files), they will be ignored by Penumbra.\n\n"
|
||||||
|
+ "Only touch this if you experience sound problems.\n"
|
||||||
|
+ "If you toggle this, make sure no modified or to-be-modified sound file is currently playing or was recently playing, else you might crash." );
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawLogLoadedFilesBox()
|
private void DrawLogLoadedFilesBox()
|
||||||
{
|
{
|
||||||
ImGui.Checkbox( "Log Loaded Files", ref _base._penumbra.ResourceLoader.LogAllFiles );
|
ImGui.Checkbox( "Log Loaded Files", ref _base._penumbra.ResourceLoader.LogAllFiles );
|
||||||
|
|
@ -306,6 +333,7 @@ public partial class SettingsInterface
|
||||||
private void DrawAdvancedSettings()
|
private void DrawAdvancedSettings()
|
||||||
{
|
{
|
||||||
DrawTempFolder();
|
DrawTempFolder();
|
||||||
|
DrawDisableSoundStreamingBox();
|
||||||
DrawLogLoadedFilesBox();
|
DrawLogLoadedFilesBox();
|
||||||
DrawDisableNotificationsBox();
|
DrawDisableNotificationsBox();
|
||||||
DrawEnableHttpApiBox();
|
DrawEnableHttpApiBox();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue