mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Remove MusicManager/DisableSoundStreaming
This commit is contained in:
parent
9dd12f4a71
commit
c49fce4487
7 changed files with 1 additions and 96 deletions
|
|
@ -308,12 +308,6 @@ public partial class ModCollection
|
|||
{
|
||||
foreach( var (path, file) in subMod.Files.Concat( subMod.FileSwaps ) )
|
||||
{
|
||||
// Skip all filtered files
|
||||
if( Mod.FilterFile( path ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
AddFile( path, file, parentMod );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ public partial class Configuration : IPluginConfiguration
|
|||
public bool FixMainWindow { get; set; } = false;
|
||||
public bool ShowAdvanced { get; set; }
|
||||
public bool AutoDeduplicateOnImport { get; set; } = false;
|
||||
public bool DisableSoundStreaming { get; set; } = true;
|
||||
public bool EnableHttpApi { get; set; }
|
||||
|
||||
public string DefaultModImportPath { get; set; } = string.Empty;
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
using System;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Utility.Signatures;
|
||||
|
||||
namespace Penumbra.Interop;
|
||||
|
||||
// Use this to disable streaming of specific soundfiles,
|
||||
// which will allow replacement of .scd files.
|
||||
public unsafe class MusicManager
|
||||
{
|
||||
// The wildcard is the offset in framework to the MusicManager in Framework.
|
||||
[Signature( "48 8B 8E ?? ?? ?? ?? 39 78 20 0F 94 C2 45 33 C0", ScanType = ScanType.Text )]
|
||||
private readonly IntPtr _musicInitCallLocation = IntPtr.Zero;
|
||||
|
||||
private readonly IntPtr _musicManager;
|
||||
|
||||
public MusicManager()
|
||||
{
|
||||
SignatureHelper.Initialise( this );
|
||||
var framework = Dalamud.Framework.Address.BaseAddress;
|
||||
var musicManagerOffset = *( int* )( _musicInitCallLocation + 3 );
|
||||
_musicManager = *( IntPtr* )( framework + musicManagerOffset );
|
||||
PluginLog.Debug( "MusicManager found at 0x{Location:X16}", _musicManager.ToInt64() );
|
||||
}
|
||||
|
||||
public bool StreamingEnabled
|
||||
{
|
||||
get => *( bool* )( _musicManager + 50 );
|
||||
private set
|
||||
{
|
||||
PluginLog.Debug( value ? "Music streaming enabled." : "Music streaming disabled." );
|
||||
*( bool* )( _musicManager + 50 ) = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void EnableStreaming()
|
||||
=> StreamingEnabled = true;
|
||||
|
||||
public void DisableStreaming()
|
||||
=> StreamingEnabled = false;
|
||||
}
|
||||
|
|
@ -70,13 +70,6 @@ public partial class Mod
|
|||
.ToList();
|
||||
}
|
||||
|
||||
// Filter invalid files.
|
||||
// If audio streaming is not disabled, replacing .scd files crashes the game,
|
||||
// so only add those files if it is disabled.
|
||||
public static bool FilterFile( Utf8GamePath gamePath )
|
||||
=> !Penumbra.Config.DisableSoundStreaming
|
||||
&& gamePath.Path.EndsWith( '.', 's', 'c', 'd' );
|
||||
|
||||
private static IModGroup? LoadModGroup( FileInfo file, DirectoryInfo basePath )
|
||||
{
|
||||
if( !File.Exists( file.FullName ) )
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ public class Penumbra : IDisposable
|
|||
|
||||
public readonly ResourceLogger ResourceLogger;
|
||||
public readonly PathResolver PathResolver;
|
||||
public readonly MusicManager MusicManager;
|
||||
public readonly ObjectReloader ObjectReloader;
|
||||
public readonly ModFileSystem ModFileSystem;
|
||||
public readonly PenumbraApi Api;
|
||||
|
|
@ -131,12 +130,6 @@ public class Penumbra : IDisposable
|
|||
Backup.CreateBackup( PenumbraBackupFiles() );
|
||||
Config = Configuration.Load();
|
||||
|
||||
MusicManager = new MusicManager();
|
||||
if( Config.DisableSoundStreaming )
|
||||
{
|
||||
MusicManager.DisableStreaming();
|
||||
}
|
||||
|
||||
ResidentResources = new ResidentResourceManager();
|
||||
TempMods = new TempModManager();
|
||||
MetaFileManager = new MetaFileManager();
|
||||
|
|
@ -462,7 +455,6 @@ public class Penumbra : IDisposable
|
|||
sb.AppendFormat( "> **`Plugin Version: `** {0}\n", Version );
|
||||
sb.AppendFormat( "> **`Commit Hash: `** {0}\n", CommitHash );
|
||||
sb.AppendFormat( "> **`Enable Mods: `** {0}\n", Config.EnableMods );
|
||||
sb.AppendFormat( "> **`Enable Sound Modification: `** {0}\n", Config.DisableSoundStreaming );
|
||||
sb.AppendFormat( "> **`Enable HTTP API: `** {0}\n", Config.EnableHttpApi );
|
||||
sb.AppendFormat( "> **`Root Directory: `** `{0}`, {1}\n", Config.ModDirectory, exists ? "Exists" : "Not Existing" );
|
||||
sb.AppendFormat( "> **`Free Drive Space: `** {0}\n",
|
||||
|
|
|
|||
|
|
@ -99,12 +99,11 @@ public partial class ConfigWindow
|
|||
PrintValue( "Mod Manager BasePath Exists", Directory.Exists( manager.BasePath.FullName ).ToString() );
|
||||
PrintValue( "Mod Manager Valid", manager.Valid.ToString() );
|
||||
PrintValue( "Path Resolver Enabled", _window._penumbra.PathResolver.Enabled.ToString() );
|
||||
PrintValue( "Music Manager Streaming Disabled", ( !_window._penumbra.MusicManager.StreamingEnabled ).ToString() );
|
||||
PrintValue( "Web Server Enabled", ( _window._penumbra.WebServer != null ).ToString() );
|
||||
}
|
||||
|
||||
// Draw all resources currently replaced by Penumbra and (if existing) the resources they replace.
|
||||
// Resources are collected by iterating through the
|
||||
// Resources are collected by iterating through the
|
||||
private static unsafe void DrawDebugTabReplacedResources()
|
||||
{
|
||||
if( !ImGui.CollapsingHeader( "Replaced Resources" ) )
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ public partial class ConfigWindow
|
|||
"Automatically deduplicate mod files on import. This will make mod file sizes smaller, but deletes (binary identical) files.",
|
||||
Penumbra.Config.AutoDeduplicateOnImport, v => Penumbra.Config.AutoDeduplicateOnImport = v );
|
||||
DrawRequestedResourceLogging();
|
||||
DrawDisableSoundStreamingBox();
|
||||
DrawEnableHttpApiBox();
|
||||
DrawEnableDebugModeBox();
|
||||
DrawEnableFullResourceLoggingBox();
|
||||
|
|
@ -62,36 +61,6 @@ public partial class ConfigWindow
|
|||
}
|
||||
}
|
||||
|
||||
// Toggling audio streaming will need to apply to the music manager
|
||||
// and rediscover mods due to determining whether .scds will be loaded or not.
|
||||
private void DrawDisableSoundStreamingBox()
|
||||
{
|
||||
var tmp = Penumbra.Config.DisableSoundStreaming;
|
||||
if( ImGui.Checkbox( "##streaming", ref tmp ) && tmp != Penumbra.Config.DisableSoundStreaming )
|
||||
{
|
||||
Penumbra.Config.DisableSoundStreaming = tmp;
|
||||
Penumbra.Config.Save();
|
||||
if( tmp )
|
||||
{
|
||||
_window._penumbra.MusicManager.DisableStreaming();
|
||||
}
|
||||
else
|
||||
{
|
||||
_window._penumbra.MusicManager.EnableStreaming();
|
||||
}
|
||||
|
||||
Penumbra.ModManager.DiscoverMods();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiUtil.LabeledHelpMarker( "Enable Sound Modification",
|
||||
"Disable streaming in the games audio engine. The game enables this by default, and Penumbra should disable it.\n"
|
||||
+ "If this is unchecked, 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 like audio stuttering.\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.\n"
|
||||
+ "You might need to restart your game for this to fully take effect." );
|
||||
}
|
||||
|
||||
// Creates and destroys the web server when toggled.
|
||||
private void DrawEnableHttpApiBox()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue